@riducms/translations 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Haniel Ubogu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # `@riducms/translations`
2
+
3
+ Typed interface-language catalogs, locale negotiation, plural selection, and `Intl` formatting for
4
+ the Ridu admin and statically registered admin plugins. It translates the authoring interface;
5
+ content localization is configured separately in executable Go config.
6
+
7
+ Generated projects can expose the built-in catalogs through their thin admin entry:
8
+
9
+ ```ts
10
+ import { mountAdmin } from "@riducms/admin";
11
+ import { ar, en, fr } from "@riducms/translations";
12
+
13
+ mountAdmin({
14
+ target,
15
+ clientFactory,
16
+ languages: [en, fr, ar],
17
+ });
18
+ ```
19
+
20
+ The Go `AdminLocalization` declaration and these static imports must agree. Missing languages,
21
+ catalog keys, or changed interpolation placeholders fail validation/build instead of silently
22
+ falling back. Use `defineTranslationLanguage` for a complete custom language and
23
+ `extendTranslationLanguage` to extend an existing one.
24
+
25
+ See [Localization](../../website/src/content/docs/localization.md) for interface and content locale
26
+ configuration, fallback behavior, SDK requests, migration implications, and current limits.
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "bugs": {
3
+ "url": "https://github.com/riducms/ridu/issues"
4
+ },
5
+ "description": "Typed admin translations, language negotiation, plurals, and Intl formatting for Ridu.",
6
+ "exports": {
7
+ ".": "./src/index.ts",
8
+ "./languages/en": "./src/languages/en.ts"
9
+ },
10
+ "files": [
11
+ "src",
12
+ "LICENSE"
13
+ ],
14
+ "homepage": "https://riducms.com",
15
+ "license": "MIT",
16
+ "name": "@riducms/translations",
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "provenance": true
20
+ },
21
+ "repository": {
22
+ "directory": "packages/translations",
23
+ "type": "git",
24
+ "url": "git+https://github.com/riducms/ridu.git"
25
+ },
26
+ "scripts": {
27
+ "check": "tsc -p tsconfig.json",
28
+ "test": "bun test"
29
+ },
30
+ "type": "module",
31
+ "version": "0.1.0"
32
+ }
package/src/index.ts ADDED
@@ -0,0 +1,26 @@
1
+ export { ar, arMessages } from "./languages/ar";
2
+ export { en, enMessages } from "./languages/en";
3
+ export { fr, frMessages } from "./languages/fr";
4
+ export {
5
+ createAdminI18n,
6
+ defineTranslationLanguage,
7
+ extendTranslationLanguage,
8
+ parseAcceptLanguage,
9
+ resolvePreferredLanguage,
10
+ validatePluginMessageCatalog,
11
+ validateLanguageCatalogs,
12
+ type CreateAdminI18nOptions,
13
+ } from "./runtime";
14
+ export type {
15
+ AdminI18n,
16
+ AdminTranslationKey,
17
+ CoreTranslationCatalog,
18
+ CoreTranslationKey,
19
+ PluginMessageCatalog,
20
+ PluginTranslationKey,
21
+ PluralCategory,
22
+ PluralMessage,
23
+ TranslationLanguage,
24
+ TranslationMessage,
25
+ TranslationVariables,
26
+ } from "./types";