@digitaldefiance/i18n-lib 3.6.1 → 3.6.2
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/README.md +5 -0
- package/package.json +1 -1
- package/src/active-context.d.ts +12 -6
- package/src/active-context.d.ts.map +1 -1
- package/src/component-registry.d.ts +44 -12
- package/src/component-registry.d.ts.map +1 -1
- package/src/component-registry.js +44 -12
- package/src/component-registry.js.map +1 -1
- package/src/context-error-type.d.ts +4 -0
- package/src/context-error-type.d.ts.map +1 -1
- package/src/context-error-type.js +4 -0
- package/src/context-error-type.js.map +1 -1
- package/src/core/component-store.d.ts +69 -1
- package/src/core/component-store.d.ts.map +1 -1
- package/src/core/component-store.js +69 -1
- package/src/core/component-store.js.map +1 -1
- package/src/core/context-manager.d.ts +53 -1
- package/src/core/context-manager.d.ts.map +1 -1
- package/src/core/context-manager.js +52 -4
- package/src/core/context-manager.js.map +1 -1
- package/src/core/enum-registry.d.ts +34 -0
- package/src/core/enum-registry.d.ts.map +1 -1
- package/src/core/enum-registry.js +34 -0
- package/src/core/enum-registry.js.map +1 -1
- package/src/core/i18n-engine.d.ts +186 -0
- package/src/core/i18n-engine.d.ts.map +1 -1
- package/src/core/i18n-engine.js +189 -17
- package/src/core/i18n-engine.js.map +1 -1
- package/src/core/language-registry.d.ts +139 -0
- package/src/core/language-registry.d.ts.map +1 -1
- package/src/core/language-registry.js +138 -0
- package/src/core/language-registry.js.map +1 -1
- package/src/core-i18n.d.ts.map +1 -1
- package/src/core-i18n.js +16 -416
- package/src/core-i18n.js.map +1 -1
- package/src/enum-registry.d.ts +41 -21
- package/src/enum-registry.d.ts.map +1 -1
- package/src/enum-registry.js +44 -24
- package/src/enum-registry.js.map +1 -1
- package/src/errors/context-error.d.ts +11 -0
- package/src/errors/context-error.d.ts.map +1 -1
- package/src/errors/context-error.js +11 -0
- package/src/errors/context-error.js.map +1 -1
- package/src/errors/handleable.d.ts +33 -0
- package/src/errors/handleable.d.ts.map +1 -1
- package/src/errors/handleable.js +33 -0
- package/src/errors/handleable.js.map +1 -1
- package/src/errors/i18n-error.d.ts +107 -0
- package/src/errors/i18n-error.d.ts.map +1 -1
- package/src/errors/i18n-error.js +104 -0
- package/src/errors/i18n-error.js.map +1 -1
- package/src/gender/gender-categories.d.ts +11 -0
- package/src/gender/gender-categories.d.ts.map +1 -1
- package/src/gender/gender-categories.js +5 -0
- package/src/gender/gender-categories.js.map +1 -1
- package/src/gender/gender-resolver.d.ts +6 -1
- package/src/gender/gender-resolver.d.ts.map +1 -1
- package/src/gender/gender-resolver.js +6 -1
- package/src/gender/gender-resolver.js.map +1 -1
- package/src/interfaces/component-config.interface.d.ts +6 -0
- package/src/interfaces/component-config.interface.d.ts.map +1 -1
- package/src/interfaces/engine-config.interface.d.ts +9 -0
- package/src/interfaces/engine-config.interface.d.ts.map +1 -1
- package/src/interfaces/handleable-error-options.d.ts +7 -0
- package/src/interfaces/handleable-error-options.d.ts.map +1 -1
- package/src/interfaces/handleable.d.ts +15 -0
- package/src/interfaces/handleable.d.ts.map +1 -1
- package/src/interfaces/i18n-engine.interface.d.ts +20 -0
- package/src/interfaces/i18n-engine.interface.d.ts.map +1 -1
- package/src/interfaces/language-definition.interface.d.ts +7 -0
- package/src/interfaces/language-definition.interface.d.ts.map +1 -1
- package/src/interfaces/translation-options.interface.d.ts +6 -0
- package/src/interfaces/translation-options.interface.d.ts.map +1 -1
- package/src/interfaces/validation-result.interface.d.ts +10 -0
- package/src/interfaces/validation-result.interface.d.ts.map +1 -1
- package/src/registry-error-type.d.ts +7 -0
- package/src/registry-error-type.d.ts.map +1 -1
- package/src/registry-error-type.js +7 -0
- package/src/registry-error-type.js.map +1 -1
- package/src/strings/de.d.ts +3 -0
- package/src/strings/de.d.ts.map +1 -0
- package/src/strings/de.js +57 -0
- package/src/strings/de.js.map +1 -0
- package/src/strings/en-GB.d.ts +3 -0
- package/src/strings/en-GB.d.ts.map +1 -0
- package/src/strings/en-GB.js +57 -0
- package/src/strings/en-GB.js.map +1 -0
- package/src/strings/en-US.d.ts +3 -0
- package/src/strings/en-US.d.ts.map +1 -0
- package/src/strings/en-US.js +57 -0
- package/src/strings/en-US.js.map +1 -0
- package/src/strings/es.d.ts +3 -0
- package/src/strings/es.d.ts.map +1 -0
- package/src/strings/es.js +57 -0
- package/src/strings/es.js.map +1 -0
- package/src/strings/fr.d.ts +3 -0
- package/src/strings/fr.d.ts.map +1 -0
- package/src/strings/fr.js +57 -0
- package/src/strings/fr.js.map +1 -0
- package/src/strings/ja.d.ts +3 -0
- package/src/strings/ja.d.ts.map +1 -0
- package/src/strings/ja.js +57 -0
- package/src/strings/ja.js.map +1 -0
- package/src/strings/uk.d.ts +3 -0
- package/src/strings/uk.d.ts.map +1 -0
- package/src/strings/uk.js +57 -0
- package/src/strings/uk.js.map +1 -0
- package/src/strings/zh-CN.d.ts +3 -0
- package/src/strings/zh-CN.d.ts.map +1 -0
- package/src/strings/zh-CN.js +57 -0
- package/src/strings/zh-CN.js.map +1 -0
- package/src/types/plural-types.d.ts +10 -3
- package/src/types/plural-types.d.ts.map +1 -1
- package/src/types/plural-types.js +8 -2
- package/src/types/plural-types.js.map +1 -1
- package/src/utils/currency.d.ts +53 -0
- package/src/utils/currency.d.ts.map +1 -1
- package/src/utils/currency.js +35 -0
- package/src/utils/currency.js.map +1 -1
- package/src/utils/html-escape.d.ts +14 -0
- package/src/utils/html-escape.d.ts.map +1 -1
- package/src/utils/html-escape.js +20 -0
- package/src/utils/html-escape.js.map +1 -1
- package/src/utils/lru-cache.d.ts +29 -0
- package/src/utils/lru-cache.d.ts.map +1 -1
- package/src/utils/lru-cache.js +29 -0
- package/src/utils/lru-cache.js.map +1 -1
- package/src/utils/plural-helpers.d.ts +16 -0
- package/src/utils/plural-helpers.d.ts.map +1 -1
- package/src/utils/plural-helpers.js +16 -0
- package/src/utils/plural-helpers.js.map +1 -1
- package/src/utils/safe-object.d.ts +30 -0
- package/src/utils/safe-object.d.ts.map +1 -1
- package/src/utils/safe-object.js +33 -0
- package/src/utils/safe-object.js.map +1 -1
- package/src/utils/string-utils.d.ts +19 -0
- package/src/utils/string-utils.d.ts.map +1 -1
- package/src/utils/string-utils.js +18 -1
- package/src/utils/string-utils.js.map +1 -1
- package/src/utils/timezone.d.ts +36 -0
- package/src/utils/timezone.d.ts.map +1 -1
- package/src/utils/timezone.js +36 -0
- package/src/utils/timezone.js.map +1 -1
- package/src/utils/validation.d.ts +25 -0
- package/src/utils/validation.d.ts.map +1 -1
- package/src/utils/validation.js +25 -0
- package/src/utils/validation.js.map +1 -1
- package/src/validation/plural-validator.d.ts +25 -2
- package/src/validation/plural-validator.d.ts.map +1 -1
- package/src/validation/plural-validator.js +22 -4
- package/src/validation/plural-validator.js.map +1 -1
package/README.md
CHANGED
package/package.json
CHANGED
package/src/active-context.d.ts
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
import { CurrencyCode } from './utils/currency';
|
|
2
2
|
import { Timezone } from './utils/timezone';
|
|
3
3
|
import { LanguageContextSpace } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Represents the active internationalization context for user and admin interfaces,
|
|
6
|
+
* including language, currency, and timezone settings.
|
|
7
|
+
*
|
|
8
|
+
* @template TLanguage The type of language codes (e.g., 'en-US', 'fr').
|
|
9
|
+
*/
|
|
4
10
|
export interface IActiveContext<TLanguage extends string> {
|
|
5
11
|
/**
|
|
6
|
-
* The default language for the user
|
|
12
|
+
* The default language for the user-facing application.
|
|
7
13
|
*/
|
|
8
14
|
language: TLanguage;
|
|
9
15
|
/**
|
|
10
|
-
* The default language for the admin interface
|
|
16
|
+
* The default language for the admin interface.
|
|
11
17
|
*/
|
|
12
18
|
adminLanguage: TLanguage;
|
|
13
19
|
/**
|
|
14
|
-
* The default currency code for the user
|
|
20
|
+
* The default currency code for the user-facing application.
|
|
15
21
|
*/
|
|
16
22
|
currencyCode: CurrencyCode;
|
|
17
23
|
/**
|
|
18
|
-
* The
|
|
24
|
+
* The current language context space (e.g., 'user' or 'admin').
|
|
19
25
|
*/
|
|
20
26
|
currentContext: LanguageContextSpace;
|
|
21
27
|
/**
|
|
22
|
-
* The default timezone for the user
|
|
28
|
+
* The default timezone for the user-facing application.
|
|
23
29
|
*/
|
|
24
30
|
timezone: Timezone;
|
|
25
31
|
/**
|
|
26
|
-
* The default timezone for the admin interface
|
|
32
|
+
* The default timezone for the admin interface.
|
|
27
33
|
*/
|
|
28
34
|
adminTimezone: Timezone;
|
|
29
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-context.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/active-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,MAAM;IACtD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"active-context.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/active-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,MAAM;IACtD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,aAAa,EAAE,SAAS,CAAC;IAEzB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;IAE3B;;OAEG;IACH,cAAc,EAAE,oBAAoB,CAAC;IAErC;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,aAAa,EAAE,QAAQ,CAAC;CACzB"}
|
|
@@ -17,53 +17,85 @@ export declare class ComponentRegistry<TLanguages extends string> {
|
|
|
17
17
|
private readonly validationConfig;
|
|
18
18
|
private readonly registeredLanguages;
|
|
19
19
|
private readonly constants?;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new ComponentRegistry.
|
|
22
|
+
* @param languages - Array of supported language codes.
|
|
23
|
+
* @param validationConfig - Configuration for validation rules.
|
|
24
|
+
* @param constants - Optional constants for variable replacement in templates.
|
|
25
|
+
*/
|
|
20
26
|
constructor(languages: readonly TLanguages[], validationConfig: ValidationConfig, constants?: Record<string, any>);
|
|
21
27
|
/**
|
|
22
|
-
* Update the set of registered languages (for dynamic language addition)
|
|
28
|
+
* Update the set of registered languages (for dynamic language addition).
|
|
29
|
+
* @param languages - Array of language codes to register.
|
|
23
30
|
*/
|
|
24
31
|
updateRegisteredLanguages(languages: readonly TLanguages[]): void;
|
|
25
32
|
/**
|
|
26
|
-
* Register a new component with its translations
|
|
33
|
+
* Register a new component with its translations.
|
|
34
|
+
* @param registration - Component registration payload.
|
|
35
|
+
* @returns ValidationResult indicating success or errors.
|
|
36
|
+
* @throws RegistryError if component is already registered or validation fails.
|
|
27
37
|
*/
|
|
28
38
|
registerComponent<TStringKeys extends string>(registration: ComponentRegistration<TStringKeys, TLanguages>): ValidationResult;
|
|
29
39
|
/**
|
|
30
|
-
* Update strings for an existing component
|
|
40
|
+
* Update strings for an existing component.
|
|
41
|
+
* @param componentId - The ID of the component to update.
|
|
42
|
+
* @param strings - Partial strings to update.
|
|
43
|
+
* @returns ValidationResult indicating success or errors.
|
|
44
|
+
* @throws RegistryError if component is not found.
|
|
31
45
|
*/
|
|
32
46
|
updateComponentStrings<TStringKeys extends string>(componentId: string, strings: PartialComponentLanguageStrings<TStringKeys, TLanguages>): ValidationResult;
|
|
33
47
|
/**
|
|
34
|
-
* Get a translation for a specific component, string key, and language
|
|
48
|
+
* Get a translation for a specific component, string key, and language.
|
|
49
|
+
* @param request - Translation request containing componentId, stringKey, language, and variables.
|
|
50
|
+
* @returns TranslationResponse with the translated string and metadata.
|
|
51
|
+
* @throws RegistryError if component, language, or string key is not found.
|
|
35
52
|
*/
|
|
36
53
|
getTranslation<TStringKeys extends string>(request: TranslationRequest<TStringKeys, TLanguages>): TranslationResponse;
|
|
37
54
|
/**
|
|
38
|
-
* Get all registered components
|
|
55
|
+
* Get all registered components.
|
|
56
|
+
* @returns Array of all registered ComponentDefinition objects.
|
|
39
57
|
*/
|
|
40
58
|
getComponents(): ReadonlyArray<ComponentDefinition<any>>;
|
|
41
59
|
/**
|
|
42
|
-
* Get a specific component by ID
|
|
60
|
+
* Get a specific component by ID.
|
|
61
|
+
* @param componentId - The ID of the component to retrieve.
|
|
62
|
+
* @returns The ComponentDefinition or undefined if not found.
|
|
43
63
|
*/
|
|
44
64
|
getComponent<TStringKeys extends string>(componentId: string): ComponentDefinition<TStringKeys> | undefined;
|
|
45
65
|
/**
|
|
46
|
-
* Check if a component is registered
|
|
66
|
+
* Check if a component is registered.
|
|
67
|
+
* @param componentId - The ID of the component to check.
|
|
68
|
+
* @returns True if the component is registered, false otherwise.
|
|
47
69
|
*/
|
|
48
70
|
hasComponent(componentId: string): boolean;
|
|
49
71
|
/**
|
|
50
|
-
* Get all strings for a component in all languages
|
|
72
|
+
* Get all strings for a component in all languages.
|
|
73
|
+
* @param componentId - The ID of the component.
|
|
74
|
+
* @returns ComponentLanguageStrings or undefined if not found.
|
|
51
75
|
*/
|
|
52
76
|
getComponentStrings<TStringKeys extends string>(componentId: string): ComponentLanguageStrings<TStringKeys, TLanguages> | undefined;
|
|
53
77
|
/**
|
|
54
|
-
* Validate a component registration
|
|
78
|
+
* Validate a component registration.
|
|
79
|
+
* @param registration - Component registration to validate.
|
|
80
|
+
* @returns ValidationResult with details of missing keys and errors.
|
|
55
81
|
*/
|
|
56
82
|
private validateComponentRegistration;
|
|
57
83
|
/**
|
|
58
|
-
* Complete missing strings with fallbacks
|
|
84
|
+
* Complete missing strings with fallbacks.
|
|
85
|
+
* @param component - The component definition.
|
|
86
|
+
* @param strings - Partial strings provided.
|
|
87
|
+
* @returns Complete strings with fallbacks filled in.
|
|
59
88
|
*/
|
|
60
89
|
private completeStringsWithFallbacks;
|
|
61
90
|
/**
|
|
62
|
-
* Merge existing strings with new strings
|
|
91
|
+
* Merge existing strings with new strings.
|
|
92
|
+
* @param existing - Existing complete strings.
|
|
93
|
+
* @param updates - Partial updates to apply.
|
|
94
|
+
* @returns Merged partial strings.
|
|
63
95
|
*/
|
|
64
96
|
private mergeStrings;
|
|
65
97
|
/**
|
|
66
|
-
* Clear all components and their strings (useful for testing)
|
|
98
|
+
* Clear all components and their strings (useful for testing).
|
|
67
99
|
*/
|
|
68
100
|
clearAllComponents(): void;
|
|
69
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/component-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,wBAAwB,EAExB,+BAA+B,EAEhC,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;GAEG;AACH,qBAAa,iBAAiB,CAAC,UAAU,SAAS,MAAM;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+C;IAC1E,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAG7B;IACJ,OAAO,CAAC,QAAQ,CAAC,gBAAg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AAU,CAAC,GAC3D,gBAAgB;IA6CnB;;;;;;OAMG;IACI,sBAAsB,CAAC,WAAW,SAAS,MAAM,EACtD,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,+BAA+B,CAAC,WAAW,EAAE,UAAU,CAAC,GAChE,gBAAgB;IAoCnB;;;;;OAKG;IACI,cAAc,CAAC,WAAW,SAAS,MAAM,EAC9C,OAAO,EAAE,kBAAkB,CAAC,WAAW,EAAE,UAAU,CAAC,GACnD,mBAAmB;IAwEtB;;;OAGG;IACI,aAAa,IAAI,aAAa,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAI/D;;;;OAIG;IACI,YAAY,CAAC,WAAW,SAAS,MAAM,EAC5C,WAAW,EAAE,MAAM,GAClB,mBAAmB,CAAC,WAAW,CAAC,GAAG,SAAS;IAM/C;;;;OAIG;IACI,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAIjD;;;;OAIG;IACI,mBAAmB,CAAC,WAAW,SAAS,MAAM,EACnD,WAAW,EAAE,MAAM,GAClB,wBAAwB,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,SAAS;IAMhE;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IAyDrC;;;;;OAKG;IACH,OAAO,CAAC,4BAA4B;IAkCpC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IA+BpB;;OAEG;IACI,kBAAkB,IAAI,IAAI;CAIlC"}
|
|
@@ -16,20 +16,30 @@ class ComponentRegistry {
|
|
|
16
16
|
validationConfig;
|
|
17
17
|
registeredLanguages;
|
|
18
18
|
constants;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new ComponentRegistry.
|
|
21
|
+
* @param languages - Array of supported language codes.
|
|
22
|
+
* @param validationConfig - Configuration for validation rules.
|
|
23
|
+
* @param constants - Optional constants for variable replacement in templates.
|
|
24
|
+
*/
|
|
19
25
|
constructor(languages, validationConfig, constants) {
|
|
20
26
|
this.registeredLanguages = new Set(languages);
|
|
21
27
|
this.validationConfig = validationConfig;
|
|
22
28
|
this.constants = constants;
|
|
23
29
|
}
|
|
24
30
|
/**
|
|
25
|
-
* Update the set of registered languages (for dynamic language addition)
|
|
31
|
+
* Update the set of registered languages (for dynamic language addition).
|
|
32
|
+
* @param languages - Array of language codes to register.
|
|
26
33
|
*/
|
|
27
34
|
updateRegisteredLanguages(languages) {
|
|
28
35
|
this.registeredLanguages.clear();
|
|
29
36
|
languages.forEach((lang) => this.registeredLanguages.add(lang));
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
32
|
-
* Register a new component with its translations
|
|
39
|
+
* Register a new component with its translations.
|
|
40
|
+
* @param registration - Component registration payload.
|
|
41
|
+
* @returns ValidationResult indicating success or errors.
|
|
42
|
+
* @throws RegistryError if component is already registered or validation fails.
|
|
33
43
|
*/
|
|
34
44
|
registerComponent(registration) {
|
|
35
45
|
const { component, strings } = registration;
|
|
@@ -55,7 +65,11 @@ class ComponentRegistry {
|
|
|
55
65
|
return validationResult;
|
|
56
66
|
}
|
|
57
67
|
/**
|
|
58
|
-
* Update strings for an existing component
|
|
68
|
+
* Update strings for an existing component.
|
|
69
|
+
* @param componentId - The ID of the component to update.
|
|
70
|
+
* @param strings - Partial strings to update.
|
|
71
|
+
* @returns ValidationResult indicating success or errors.
|
|
72
|
+
* @throws RegistryError if component is not found.
|
|
59
73
|
*/
|
|
60
74
|
updateComponentStrings(componentId, strings) {
|
|
61
75
|
const component = this.components.get(componentId);
|
|
@@ -78,7 +92,10 @@ class ComponentRegistry {
|
|
|
78
92
|
return validationResult;
|
|
79
93
|
}
|
|
80
94
|
/**
|
|
81
|
-
* Get a translation for a specific component, string key, and language
|
|
95
|
+
* Get a translation for a specific component, string key, and language.
|
|
96
|
+
* @param request - Translation request containing componentId, stringKey, language, and variables.
|
|
97
|
+
* @returns TranslationResponse with the translated string and metadata.
|
|
98
|
+
* @throws RegistryError if component, language, or string key is not found.
|
|
82
99
|
*/
|
|
83
100
|
getTranslation(request) {
|
|
84
101
|
const { componentId, stringKey, language, variables } = request;
|
|
@@ -122,31 +139,40 @@ class ComponentRegistry {
|
|
|
122
139
|
};
|
|
123
140
|
}
|
|
124
141
|
/**
|
|
125
|
-
* Get all registered components
|
|
142
|
+
* Get all registered components.
|
|
143
|
+
* @returns Array of all registered ComponentDefinition objects.
|
|
126
144
|
*/
|
|
127
145
|
getComponents() {
|
|
128
146
|
return Array.from(this.components.values());
|
|
129
147
|
}
|
|
130
148
|
/**
|
|
131
|
-
* Get a specific component by ID
|
|
149
|
+
* Get a specific component by ID.
|
|
150
|
+
* @param componentId - The ID of the component to retrieve.
|
|
151
|
+
* @returns The ComponentDefinition or undefined if not found.
|
|
132
152
|
*/
|
|
133
153
|
getComponent(componentId) {
|
|
134
154
|
return this.components.get(componentId);
|
|
135
155
|
}
|
|
136
156
|
/**
|
|
137
|
-
* Check if a component is registered
|
|
157
|
+
* Check if a component is registered.
|
|
158
|
+
* @param componentId - The ID of the component to check.
|
|
159
|
+
* @returns True if the component is registered, false otherwise.
|
|
138
160
|
*/
|
|
139
161
|
hasComponent(componentId) {
|
|
140
162
|
return this.components.has(componentId);
|
|
141
163
|
}
|
|
142
164
|
/**
|
|
143
|
-
* Get all strings for a component in all languages
|
|
165
|
+
* Get all strings for a component in all languages.
|
|
166
|
+
* @param componentId - The ID of the component.
|
|
167
|
+
* @returns ComponentLanguageStrings or undefined if not found.
|
|
144
168
|
*/
|
|
145
169
|
getComponentStrings(componentId) {
|
|
146
170
|
return this.componentStrings.get(componentId);
|
|
147
171
|
}
|
|
148
172
|
/**
|
|
149
|
-
* Validate a component registration
|
|
173
|
+
* Validate a component registration.
|
|
174
|
+
* @param registration - Component registration to validate.
|
|
175
|
+
* @returns ValidationResult with details of missing keys and errors.
|
|
150
176
|
*/
|
|
151
177
|
validateComponentRegistration(registration) {
|
|
152
178
|
const { component, strings } = registration;
|
|
@@ -190,7 +216,10 @@ class ComponentRegistry {
|
|
|
190
216
|
};
|
|
191
217
|
}
|
|
192
218
|
/**
|
|
193
|
-
* Complete missing strings with fallbacks
|
|
219
|
+
* Complete missing strings with fallbacks.
|
|
220
|
+
* @param component - The component definition.
|
|
221
|
+
* @param strings - Partial strings provided.
|
|
222
|
+
* @returns Complete strings with fallbacks filled in.
|
|
194
223
|
*/
|
|
195
224
|
completeStringsWithFallbacks(component, strings) {
|
|
196
225
|
const result = {};
|
|
@@ -219,7 +248,10 @@ class ComponentRegistry {
|
|
|
219
248
|
return result;
|
|
220
249
|
}
|
|
221
250
|
/**
|
|
222
|
-
* Merge existing strings with new strings
|
|
251
|
+
* Merge existing strings with new strings.
|
|
252
|
+
* @param existing - Existing complete strings.
|
|
253
|
+
* @param updates - Partial updates to apply.
|
|
254
|
+
* @returns Merged partial strings.
|
|
223
255
|
*/
|
|
224
256
|
mergeStrings(existing, updates) {
|
|
225
257
|
const result = {};
|
|
@@ -239,7 +271,7 @@ class ComponentRegistry {
|
|
|
239
271
|
return result;
|
|
240
272
|
}
|
|
241
273
|
/**
|
|
242
|
-
* Clear all components and their strings (useful for testing)
|
|
274
|
+
* Clear all components and their strings (useful for testing).
|
|
243
275
|
*/
|
|
244
276
|
clearAllComponents() {
|
|
245
277
|
this.components.clear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-registry.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/component-registry.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,qDAAiD;AACjD,+DAA0D;AAS1D,mCAAuD;AAIvD;;GAEG;AACH,MAAa,iBAAiB;IACX,UAAU,GAAG,IAAI,GAAG,EAAoC,CAAC;IACzD,gBAAgB,GAAG,IAAI,GAAG,EAGxC,CAAC;IACa,gBAAgB,CAAmB;IACnC,mBAAmB,CAAkB;IACrC,SAAS,CAAuB;IAEjD,YACE,SAAgC,EAChC,gBAAkC,EAClC,SAA+B;QAE/B,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"component-registry.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/component-registry.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,qDAAiD;AACjD,+DAA0D;AAS1D,mCAAuD;AAIvD;;GAEG;AACH,MAAa,iBAAiB;IACX,UAAU,GAAG,IAAI,GAAG,EAAoC,CAAC;IACzD,gBAAgB,GAAG,IAAI,GAAG,EAGxC,CAAC;IACa,gBAAgB,CAAmB;IACnC,mBAAmB,CAAkB;IACrC,SAAS,CAAuB;IAEjD;;;;;OAKG;IACH,YACE,SAAgC,EAChC,gBAAkC,EAClC,SAA+B;QAE/B,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,yBAAyB,CAAC,SAAgC;QAC/D,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CACtB,YAA4D;QAE5D,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;QAE5C,gCAAgC;QAChC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC;YACtC,MAAM,8BAAa,CAAC,YAAY,CAC9B,uCAAiB,CAAC,kBAAkB,EACpC,cAAc,SAAS,CAAC,EAAE,yBAAyB,EACnD,EAAE,WAAW,EAAE,SAAS,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,CAAE,CAAC;gBAC3D,CAAC;qBAAM,CAAC;oBACN,iCAAiC;oBACjC,eAAe,CAAC,SAAS,CAAC,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,SAAS,GAAG,CAAC;gBAChE,CAAC;YACH,CAAC;YAED,MAAM,CAAC,UAAU,CAAC,GAAG,eAAe,CAAC;QACvC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACK,YAAY,CAClB,QAA2D,EAC3D,OAAiE;QAEjE,MAAM,MAAM,GACV,EAAE,CAAC;QAEL,wBAAwB;QACxB,KAAK,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAGhE,EAAE,CAAC;YACJ,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,eAAe,EAAE,CAAC;QAC9C,CAAC;QAED,gBAAgB;QAChB,KAAK,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAG/D,EAAE,CAAC;YACJ,IAAI,eAAe,EAAE,CAAC;gBACpB,MAAM,CAAC,UAAU,CAAC,GAAG;oBACnB,GAAG,MAAM,CAAC,UAAU,CAAC;oBACrB,GAAG,eAAe;iBACnB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,kBAAkB;QACvB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACF;AAnZD,8CAmZC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-error-type.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/context-error-type.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,cAAc,mBAAmB;CAClC"}
|
|
1
|
+
{"version":3,"file":"context-error-type.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/context-error-type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,0DAA0D;IAC1D,cAAc,mBAAmB;CAClC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContextErrorType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Types of context-related errors
|
|
6
|
+
*/
|
|
4
7
|
var ContextErrorType;
|
|
5
8
|
(function (ContextErrorType) {
|
|
9
|
+
/** Error indicating an invalid or non-existent context */
|
|
6
10
|
ContextErrorType["InvalidContext"] = "InvalidContext";
|
|
7
11
|
})(ContextErrorType || (exports.ContextErrorType = ContextErrorType = {}));
|
|
8
12
|
//# sourceMappingURL=context-error-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-error-type.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/context-error-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"context-error-type.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/context-error-type.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,0DAA0D;IAC1D,qDAAiC,CAAA;AACnC,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B"}
|
|
@@ -2,24 +2,92 @@
|
|
|
2
2
|
* Component storage (no generics)
|
|
3
3
|
*/
|
|
4
4
|
import { ComponentConfig, ValidationResult } from '../interfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Class representing a storage for component configurations and translations.
|
|
7
|
+
*/
|
|
5
8
|
export declare class ComponentStore {
|
|
6
9
|
private components;
|
|
7
10
|
private aliasMap;
|
|
8
11
|
private constants?;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new ComponentStore instance.
|
|
14
|
+
* @param constants - Optional constants to be used in variable replacement.
|
|
15
|
+
*/
|
|
9
16
|
constructor(constants?: Record<string, any>);
|
|
17
|
+
/**
|
|
18
|
+
* Registers a new component configuration.
|
|
19
|
+
* @param config - The component configuration to register.
|
|
20
|
+
* @returns ValidationResult indicating the result of the registration.
|
|
21
|
+
* @throws {I18nError} If the component ID is already registered.
|
|
22
|
+
*/
|
|
10
23
|
register(config: ComponentConfig): ValidationResult;
|
|
24
|
+
/**
|
|
25
|
+
* Updates an existing component's strings.
|
|
26
|
+
* @param componentId - The ID of the component to update.
|
|
27
|
+
* @param strings - The new strings to merge into the component.
|
|
28
|
+
* @returns ValidationResult indicating the result of the update.
|
|
29
|
+
* @throws {I18nError} If the component is not found.
|
|
30
|
+
*/
|
|
11
31
|
update(componentId: string, strings: Record<string, Record<string, string>>): ValidationResult;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if a component or alias is registered.
|
|
34
|
+
* @param componentId - The component ID or alias to check.
|
|
35
|
+
* @returns True if the component or alias is registered, false otherwise.
|
|
36
|
+
*/
|
|
12
37
|
has(componentId: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves a component configuration by ID or alias.
|
|
40
|
+
* @param componentId - The component ID or alias to retrieve.
|
|
41
|
+
* @returns The component configuration.
|
|
42
|
+
* @throws {I18nError} If the component is not found.
|
|
43
|
+
*/
|
|
13
44
|
get(componentId: string): ComponentConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves all registered component configurations.
|
|
47
|
+
* @returns An array of all component configurations.
|
|
48
|
+
*/
|
|
14
49
|
getAll(): readonly ComponentConfig[];
|
|
50
|
+
/**
|
|
51
|
+
* Translates a key for a component in a given language, replacing variables.
|
|
52
|
+
* @param componentId - The component ID.
|
|
53
|
+
* @param key - The translation key.
|
|
54
|
+
* @param variables - Optional variables for replacement.
|
|
55
|
+
* @param language - Optional language code (default is 'en-US').
|
|
56
|
+
* @returns The translated string.
|
|
57
|
+
* @throws {I18nError} If the language or translation key is not found.
|
|
58
|
+
*/
|
|
15
59
|
translate(componentId: string, key: string, variables?: Record<string, any>, language?: string): string;
|
|
16
60
|
/**
|
|
17
|
-
* Resolve plural form from a PluralString based on count variable
|
|
61
|
+
* Resolve plural form from a PluralString based on count variable.
|
|
62
|
+
* @param value - The string or PluralString to resolve.
|
|
63
|
+
* @param count - The count for pluralization.
|
|
64
|
+
* @param language - The language code.
|
|
65
|
+
* @returns The resolved plural form string.
|
|
18
66
|
*/
|
|
19
67
|
private resolvePluralForm;
|
|
68
|
+
/**
|
|
69
|
+
* Safely translates a key for a component, returning a fallback string on error.
|
|
70
|
+
* @param componentId - The component ID.
|
|
71
|
+
* @param key - The translation key.
|
|
72
|
+
* @param variables - Optional variables for replacement.
|
|
73
|
+
* @param language - Optional language code.
|
|
74
|
+
* @returns The translated string or a fallback string if translation fails.
|
|
75
|
+
*/
|
|
20
76
|
safeTranslate(componentId: string, key: string, variables?: Record<string, any>, language?: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Validates a component configuration for missing keys across languages.
|
|
79
|
+
* @param config - The component configuration to validate.
|
|
80
|
+
* @returns ValidationResult containing errors and warnings.
|
|
81
|
+
*/
|
|
21
82
|
private validate;
|
|
83
|
+
/**
|
|
84
|
+
* Sets constants for variable replacement.
|
|
85
|
+
* @param constants - The constants to set.
|
|
86
|
+
*/
|
|
22
87
|
setConstants(constants: Record<string, any>): void;
|
|
88
|
+
/**
|
|
89
|
+
* Clears all registered components and aliases.
|
|
90
|
+
*/
|
|
23
91
|
clear(): void;
|
|
24
92
|
}
|
|
25
93
|
//# sourceMappingURL=component-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-store.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/core/component-store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKlE,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,SAAS,CAAC,CAAsB;
|
|
1
|
+
{"version":3,"file":"component-store.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/core/component-store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKlE;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,SAAS,CAAC,CAAsB;IAExC;;;OAGG;gBACS,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI3C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB;IAkBnD;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,gBAAgB;IAe9F;;;;OAIG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAIjC;;;;;OAKG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe;IASzC;;;OAGG;IACH,MAAM,IAAI,SAAS,eAAe,EAAE;IAIpC;;;;;;;;OAQG;IACH,SAAS,CACP,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM;IAoBT;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAsBzB;;;;;;;OAOG;IACH,aAAa,CACX,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM;IAQT;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IA2BhB;;;OAGG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAIlD;;OAEG;IACH,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -8,13 +8,26 @@ const errors_1 = require("../errors");
|
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const plural_types_1 = require("../types/plural-types");
|
|
10
10
|
const language_plural_map_1 = require("../pluralization/language-plural-map");
|
|
11
|
+
/**
|
|
12
|
+
* Class representing a storage for component configurations and translations.
|
|
13
|
+
*/
|
|
11
14
|
class ComponentStore {
|
|
12
15
|
components = new Map();
|
|
13
16
|
aliasMap = new Map();
|
|
14
17
|
constants;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new ComponentStore instance.
|
|
20
|
+
* @param constants - Optional constants to be used in variable replacement.
|
|
21
|
+
*/
|
|
15
22
|
constructor(constants) {
|
|
16
23
|
this.constants = constants;
|
|
17
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Registers a new component configuration.
|
|
27
|
+
* @param config - The component configuration to register.
|
|
28
|
+
* @returns ValidationResult indicating the result of the registration.
|
|
29
|
+
* @throws {I18nError} If the component ID is already registered.
|
|
30
|
+
*/
|
|
18
31
|
register(config) {
|
|
19
32
|
if (this.components.has(config.id)) {
|
|
20
33
|
throw errors_1.I18nError.duplicateComponent(config.id);
|
|
@@ -29,6 +42,13 @@ class ComponentStore {
|
|
|
29
42
|
}
|
|
30
43
|
return validation;
|
|
31
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Updates an existing component's strings.
|
|
47
|
+
* @param componentId - The ID of the component to update.
|
|
48
|
+
* @param strings - The new strings to merge into the component.
|
|
49
|
+
* @returns ValidationResult indicating the result of the update.
|
|
50
|
+
* @throws {I18nError} If the component is not found.
|
|
51
|
+
*/
|
|
32
52
|
update(componentId, strings) {
|
|
33
53
|
const existing = this.components.get(componentId);
|
|
34
54
|
if (!existing) {
|
|
@@ -41,9 +61,20 @@ class ComponentStore {
|
|
|
41
61
|
this.components.set(componentId, updated);
|
|
42
62
|
return this.validate(updated);
|
|
43
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Checks if a component or alias is registered.
|
|
66
|
+
* @param componentId - The component ID or alias to check.
|
|
67
|
+
* @returns True if the component or alias is registered, false otherwise.
|
|
68
|
+
*/
|
|
44
69
|
has(componentId) {
|
|
45
70
|
return this.components.has(componentId) || this.aliasMap.has(componentId);
|
|
46
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves a component configuration by ID or alias.
|
|
74
|
+
* @param componentId - The component ID or alias to retrieve.
|
|
75
|
+
* @returns The component configuration.
|
|
76
|
+
* @throws {I18nError} If the component is not found.
|
|
77
|
+
*/
|
|
47
78
|
get(componentId) {
|
|
48
79
|
const id = this.aliasMap.get(componentId) || componentId;
|
|
49
80
|
const component = this.components.get(id);
|
|
@@ -52,9 +83,22 @@ class ComponentStore {
|
|
|
52
83
|
}
|
|
53
84
|
return component;
|
|
54
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Retrieves all registered component configurations.
|
|
88
|
+
* @returns An array of all component configurations.
|
|
89
|
+
*/
|
|
55
90
|
getAll() {
|
|
56
91
|
return Array.from(this.components.values());
|
|
57
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Translates a key for a component in a given language, replacing variables.
|
|
95
|
+
* @param componentId - The component ID.
|
|
96
|
+
* @param key - The translation key.
|
|
97
|
+
* @param variables - Optional variables for replacement.
|
|
98
|
+
* @param language - Optional language code (default is 'en-US').
|
|
99
|
+
* @returns The translated string.
|
|
100
|
+
* @throws {I18nError} If the language or translation key is not found.
|
|
101
|
+
*/
|
|
58
102
|
translate(componentId, key, variables, language) {
|
|
59
103
|
const component = this.get(componentId);
|
|
60
104
|
const lang = language || 'en-US';
|
|
@@ -71,7 +115,11 @@ class ComponentStore {
|
|
|
71
115
|
return (0, utils_1.replaceVariables)(translation, variables, this.constants);
|
|
72
116
|
}
|
|
73
117
|
/**
|
|
74
|
-
* Resolve plural form from a PluralString based on count variable
|
|
118
|
+
* Resolve plural form from a PluralString based on count variable.
|
|
119
|
+
* @param value - The string or PluralString to resolve.
|
|
120
|
+
* @param count - The count for pluralization.
|
|
121
|
+
* @param language - The language code.
|
|
122
|
+
* @returns The resolved plural form string.
|
|
75
123
|
*/
|
|
76
124
|
resolvePluralForm(value, count, language) {
|
|
77
125
|
// If it's a simple string, return as-is
|
|
@@ -87,6 +135,14 @@ class ComponentStore {
|
|
|
87
135
|
// Resolve the plural form with fallback logic
|
|
88
136
|
return (0, plural_types_1.resolvePluralString)(value, category) || '';
|
|
89
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Safely translates a key for a component, returning a fallback string on error.
|
|
140
|
+
* @param componentId - The component ID.
|
|
141
|
+
* @param key - The translation key.
|
|
142
|
+
* @param variables - Optional variables for replacement.
|
|
143
|
+
* @param language - Optional language code.
|
|
144
|
+
* @returns The translated string or a fallback string if translation fails.
|
|
145
|
+
*/
|
|
90
146
|
safeTranslate(componentId, key, variables, language) {
|
|
91
147
|
try {
|
|
92
148
|
return this.translate(componentId, key, variables, language);
|
|
@@ -95,6 +151,11 @@ class ComponentStore {
|
|
|
95
151
|
return `[${componentId}.${key}]`;
|
|
96
152
|
}
|
|
97
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Validates a component configuration for missing keys across languages.
|
|
156
|
+
* @param config - The component configuration to validate.
|
|
157
|
+
* @returns ValidationResult containing errors and warnings.
|
|
158
|
+
*/
|
|
98
159
|
validate(config) {
|
|
99
160
|
const errors = [];
|
|
100
161
|
const warnings = [];
|
|
@@ -118,9 +179,16 @@ class ComponentStore {
|
|
|
118
179
|
warnings,
|
|
119
180
|
};
|
|
120
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Sets constants for variable replacement.
|
|
184
|
+
* @param constants - The constants to set.
|
|
185
|
+
*/
|
|
121
186
|
setConstants(constants) {
|
|
122
187
|
this.constants = constants;
|
|
123
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Clears all registered components and aliases.
|
|
191
|
+
*/
|
|
124
192
|
clear() {
|
|
125
193
|
this.components.clear();
|
|
126
194
|
this.aliasMap.clear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-store.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/core/component-store.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sCAAsC;AAEtC,oCAA4C;AAC5C,wDAA0F;AAC1F,8EAAyE;AAEzE,MAAa,cAAc;IACjB,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAC;IAChD,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IACrC,SAAS,CAAuB;IAExC,YAAY,SAA+B;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,QAAQ,CAAC,MAAuB;QAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;YACnC,MAAM,kBAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAEvC,mBAAmB;QACnB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QAED,OAAO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AAW,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,QAAQ,IAAI,OAAO,CAAC;QACjC,MAAM,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,kBAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,kBAAS,CAAC,kBAAkB,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7D,CAAC;QAED,gCAAgC;QAChC,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAE1E,OAAO,IAAA,wBAAgB,EAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"component-store.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-i18n-lib/src/core/component-store.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sCAAsC;AAEtC,oCAA4C;AAC5C,wDAA0F;AAC1F,8EAAyE;AAEzE;;GAEG;AACH,MAAa,cAAc;IACjB,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAC;IAChD,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IACrC,SAAS,CAAuB;IAExC;;;OAGG;IACH,YAAY,SAA+B;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,MAAuB;QAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;YACnC,MAAM,kBAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,EA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