@digitaldefiance/i18n-lib 1.3.13 → 1.3.14
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 +4 -0
- package/package.json +4 -3
- package/src/active-context.d.ts +30 -0
- package/src/active-context.d.ts.map +1 -0
- package/src/active-context.js +3 -0
- package/src/active-context.js.map +1 -0
- package/src/component-definition.d.ts +12 -0
- package/src/component-definition.d.ts.map +1 -0
- package/src/component-definition.js +3 -0
- package/src/component-definition.js.map +1 -0
- package/src/component-registration.d.ts +10 -0
- package/src/component-registration.d.ts.map +1 -0
- package/src/component-registration.js +3 -0
- package/src/component-registration.js.map +1 -0
- package/src/component-registry.d.ts +69 -0
- package/src/component-registry.d.ts.map +1 -0
- package/src/component-registry.js +248 -0
- package/src/component-registry.js.map +1 -0
- package/src/context-error-type.d.ts +4 -0
- package/src/context-error-type.d.ts.map +1 -0
- package/src/context-error-type.js +8 -0
- package/src/context-error-type.js.map +1 -0
- package/src/context-error.d.ts +7 -0
- package/src/context-error.d.ts.map +1 -0
- package/src/context-error.js +18 -0
- package/src/context-error.js.map +1 -0
- package/src/context-manager.d.ts +34 -0
- package/src/context-manager.d.ts.map +1 -0
- package/src/context-manager.js +60 -0
- package/src/context-manager.js.map +1 -0
- package/src/context.d.ts +45 -0
- package/src/context.d.ts.map +1 -0
- package/src/context.js +70 -0
- package/src/context.js.map +1 -0
- package/src/core-i18n.d.ts +63 -0
- package/src/core-i18n.d.ts.map +1 -0
- package/src/core-i18n.js +478 -0
- package/src/core-i18n.js.map +1 -0
- package/src/core-string-key.d.ts +43 -0
- package/src/core-string-key.d.ts.map +1 -0
- package/src/core-string-key.js +51 -0
- package/src/core-string-key.js.map +1 -0
- package/src/create-translation-adapter.d.ts +21 -0
- package/src/create-translation-adapter.d.ts.map +1 -0
- package/src/create-translation-adapter.js +37 -0
- package/src/create-translation-adapter.js.map +1 -0
- package/src/currency-code.d.ts +20 -0
- package/src/currency-code.d.ts.map +1 -0
- package/src/currency-code.js +37 -0
- package/src/currency-code.js.map +1 -0
- package/src/{currency-format.ts → currency-format.d.ts} +5 -5
- package/src/currency-format.d.ts.map +1 -0
- package/src/currency-format.js +3 -0
- package/src/currency-format.js.map +1 -0
- package/src/currency.d.ts +12 -0
- package/src/currency.d.ts.map +1 -0
- package/src/currency.js +49 -0
- package/src/currency.js.map +1 -0
- package/src/default-config.d.ts +33 -0
- package/src/default-config.d.ts.map +1 -0
- package/src/default-config.js +102 -0
- package/src/default-config.js.map +1 -0
- package/src/enum-registry.d.ts +45 -0
- package/src/enum-registry.d.ts.map +1 -0
- package/src/enum-registry.js +103 -0
- package/src/enum-registry.js.map +1 -0
- package/src/global-active-context.d.ts +51 -0
- package/src/global-active-context.d.ts.map +1 -0
- package/src/global-active-context.js +179 -0
- package/src/global-active-context.js.map +1 -0
- package/src/handleable.d.ts +14 -0
- package/src/handleable.d.ts.map +1 -0
- package/src/handleable.js +66 -0
- package/src/handleable.js.map +1 -0
- package/src/i-global-active-context.d.ts +23 -0
- package/src/i-global-active-context.d.ts.map +1 -0
- package/src/i-global-active-context.js +3 -0
- package/src/i-global-active-context.js.map +1 -0
- package/src/i-handleable-error-options.d.ts +7 -0
- package/src/i-handleable-error-options.d.ts.map +1 -0
- package/src/i-handleable-error-options.js +3 -0
- package/src/i-handleable-error-options.js.map +1 -0
- package/src/i-handleable.d.ts +6 -0
- package/src/i-handleable.d.ts.map +1 -0
- package/src/i-handleable.js +3 -0
- package/src/i-handleable.js.map +1 -0
- package/src/i18n-config.d.ts +21 -0
- package/src/i18n-config.d.ts.map +1 -0
- package/src/i18n-config.js +3 -0
- package/src/i18n-config.js.map +1 -0
- package/src/{i18n-context.ts → i18n-context.d.ts} +7 -7
- package/src/i18n-context.d.ts.map +1 -0
- package/src/i18n-context.js +3 -0
- package/src/i18n-context.js.map +1 -0
- package/src/i18n-engine.d.ts +179 -0
- package/src/i18n-engine.d.ts.map +1 -0
- package/src/i18n-engine.js +355 -0
- package/src/i18n-engine.js.map +1 -0
- package/src/{index.ts → index.d.ts} +2 -10
- package/src/index.d.ts.map +1 -0
- package/src/index.js +71 -0
- package/src/index.js.map +1 -0
- package/src/{language-codes.ts → language-codes.d.ts} +12 -23
- package/src/language-codes.d.ts.map +1 -0
- package/src/language-codes.js +32 -0
- package/src/language-codes.js.map +1 -0
- package/src/language-definition.d.ts +14 -0
- package/src/language-definition.d.ts.map +1 -0
- package/src/language-definition.js +3 -0
- package/src/language-definition.js.map +1 -0
- package/src/language-registry.d.ts +114 -0
- package/src/language-registry.d.ts.map +1 -0
- package/src/language-registry.js +217 -0
- package/src/language-registry.js.map +1 -0
- package/src/plugin-i18n-engine.d.ts +147 -0
- package/src/plugin-i18n-engine.d.ts.map +1 -0
- package/src/plugin-i18n-engine.js +369 -0
- package/src/plugin-i18n-engine.js.map +1 -0
- package/src/plugin-translatable-generic-error.d.ts +30 -0
- package/src/plugin-translatable-generic-error.d.ts.map +1 -0
- package/src/plugin-translatable-generic-error.js +72 -0
- package/src/plugin-translatable-generic-error.js.map +1 -0
- package/src/plugin-translatable-handleable-generic.d.ts +29 -0
- package/src/plugin-translatable-handleable-generic.d.ts.map +1 -0
- package/src/plugin-translatable-handleable-generic.js +44 -0
- package/src/plugin-translatable-handleable-generic.js.map +1 -0
- package/src/plugin-typed-handleable.d.ts +15 -0
- package/src/plugin-typed-handleable.d.ts.map +1 -0
- package/src/plugin-typed-handleable.js +51 -0
- package/src/plugin-typed-handleable.js.map +1 -0
- package/src/registry-config.d.ts +15 -0
- package/src/registry-config.d.ts.map +1 -0
- package/src/registry-config.js +3 -0
- package/src/registry-config.js.map +1 -0
- package/src/registry-error-type.d.ts +13 -0
- package/src/registry-error-type.d.ts.map +1 -0
- package/src/registry-error-type.js +17 -0
- package/src/registry-error-type.js.map +1 -0
- package/src/registry-error.d.ts +19 -0
- package/src/registry-error.d.ts.map +1 -0
- package/src/registry-error.js +48 -0
- package/src/registry-error.js.map +1 -0
- package/src/strict-types.d.ts +19 -0
- package/src/strict-types.d.ts.map +1 -0
- package/src/strict-types.js +18 -0
- package/src/strict-types.js.map +1 -0
- package/src/template.d.ts +13 -0
- package/src/template.d.ts.map +1 -0
- package/src/template.js +31 -0
- package/src/template.js.map +1 -0
- package/src/timezone.d.ts +12 -0
- package/src/timezone.d.ts.map +1 -0
- package/src/timezone.js +24 -0
- package/src/timezone.js.map +1 -0
- package/src/translatable.d.ts +6 -0
- package/src/translatable.d.ts.map +1 -0
- package/src/translatable.js +12 -0
- package/src/translatable.js.map +1 -0
- package/src/translation-engine.d.ts +9 -0
- package/src/translation-engine.d.ts.map +1 -0
- package/src/translation-engine.js +3 -0
- package/src/translation-engine.js.map +1 -0
- package/src/translation-request.d.ts +10 -0
- package/src/translation-request.d.ts.map +1 -0
- package/src/translation-request.js +3 -0
- package/src/translation-request.js.map +1 -0
- package/src/translation-response.d.ts +9 -0
- package/src/translation-response.d.ts.map +1 -0
- package/src/translation-response.js +3 -0
- package/src/translation-response.js.map +1 -0
- package/src/typed-error.d.ts +73 -0
- package/src/typed-error.d.ts.map +1 -0
- package/src/typed-error.js +267 -0
- package/src/typed-error.js.map +1 -0
- package/src/typed-handleable.d.ts +15 -0
- package/src/typed-handleable.d.ts.map +1 -0
- package/src/typed-handleable.js +46 -0
- package/src/typed-handleable.js.map +1 -0
- package/src/{types.ts → types.d.ts} +21 -75
- package/src/types.d.ts.map +1 -0
- package/src/types.js +19 -0
- package/src/types.js.map +1 -0
- package/src/unified-translator.d.ts +31 -0
- package/src/unified-translator.d.ts.map +1 -0
- package/src/unified-translator.js +71 -0
- package/src/unified-translator.js.map +1 -0
- package/src/utils.d.ts +65 -0
- package/src/utils.d.ts.map +1 -0
- package/src/utils.js +129 -0
- package/src/utils.js.map +1 -0
- package/src/validation-config.d.ts +12 -0
- package/src/validation-config.d.ts.map +1 -0
- package/src/validation-config.js +3 -0
- package/src/validation-config.js.map +1 -0
- package/src/validation-result.d.ts +13 -0
- package/src/validation-result.d.ts.map +1 -0
- package/src/validation-result.js +3 -0
- package/src/validation-result.js.map +1 -0
- package/LICENSE +0 -21
- package/src/active-context.ts +0 -30
- package/src/component-definition.ts +0 -11
- package/src/component-registration.ts +0 -13
- package/src/component-registry.ts +0 -392
- package/src/context-error-type.ts +0 -3
- package/src/context-error.ts +0 -16
- package/src/context-manager.ts +0 -71
- package/src/context.ts +0 -90
- package/src/core-i18n.ts +0 -609
- package/src/core-string-key.ts +0 -49
- package/src/create-translation-adapter.ts +0 -47
- package/src/currency-code.ts +0 -35
- package/src/currency.ts +0 -52
- package/src/default-config.ts +0 -199
- package/src/enum-registry.ts +0 -138
- package/src/global-active-context.ts +0 -255
- package/src/handleable.ts +0 -79
- package/src/i-global-active-context.ts +0 -59
- package/src/i-handleable-error-options.ts +0 -6
- package/src/i-handleable.ts +0 -5
- package/src/i18n-config.ts +0 -29
- package/src/i18n-engine.ts +0 -491
- package/src/language-definition.ts +0 -13
- package/src/language-registry.ts +0 -292
- package/src/plugin-i18n-engine.ts +0 -520
- package/src/plugin-translatable-generic-error.ts +0 -106
- package/src/plugin-translatable-handleable-generic.ts +0 -60
- package/src/plugin-typed-handleable.ts +0 -77
- package/src/registry-config.ts +0 -15
- package/src/registry-error-type.ts +0 -12
- package/src/registry-error.ts +0 -74
- package/src/strict-types.ts +0 -35
- package/src/template.ts +0 -63
- package/src/timezone.ts +0 -20
- package/src/translatable.ts +0 -15
- package/src/translation-engine.ts +0 -8
- package/src/translation-request.ts +0 -12
- package/src/translation-response.ts +0 -8
- package/src/typed-error.ts +0 -384
- package/src/typed-handleable.ts +0 -70
- package/src/unified-translator.ts +0 -96
- package/src/utils.ts +0 -213
- package/src/validation-config.ts +0 -11
- package/src/validation-result.ts +0 -12
package/src/context.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CurrencyCode } from './currency-code';
|
|
2
|
+
import { I18nContext } from './i18n-context';
|
|
3
|
+
import { Timezone } from './timezone';
|
|
4
|
+
import { LanguageContextSpace } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new I18n context with default values.
|
|
7
|
+
* @param defaultLanguage - The default language for the context
|
|
8
|
+
* @param defaultContext - The default language context
|
|
9
|
+
* @param defaultCurrencyCode - The default currency code (defaults to USD)
|
|
10
|
+
* @param defaultTimezone - The default timezone (defaults to UTC)
|
|
11
|
+
* @param defaultAdminTimezone - The default admin timezone (defaults to UTC)
|
|
12
|
+
* @returns A new I18nContext instance
|
|
13
|
+
*/
|
|
14
|
+
export declare function createContext<TLanguage extends string>(defaultLanguage: TLanguage, defaultContext?: LanguageContextSpace, defaultCurrencyCode?: CurrencyCode, defaultTimezone?: Timezone, defaultAdminTimezone?: Timezone): I18nContext<TLanguage>;
|
|
15
|
+
/**
|
|
16
|
+
* Sets the language for the given I18n context.
|
|
17
|
+
* @param context - The I18n context to modify
|
|
18
|
+
* @param language - The language to set
|
|
19
|
+
*/
|
|
20
|
+
export declare function setLanguage<TLanguage extends string>(context: I18nContext<TLanguage>, language: TLanguage): void;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the admin language for the given I18n context.
|
|
23
|
+
* @param context - The I18n context to modify
|
|
24
|
+
* @param language - The admin language to set
|
|
25
|
+
*/
|
|
26
|
+
export declare function setAdminLanguage<TLanguage extends string>(context: I18nContext<TLanguage>, language: TLanguage): void;
|
|
27
|
+
/**
|
|
28
|
+
* Sets the current context for the given I18n context.
|
|
29
|
+
* @param context - The I18n context to modify
|
|
30
|
+
* @param languageContext - The language context to set
|
|
31
|
+
*/
|
|
32
|
+
export declare function setContext<TLanguage extends string>(context: I18nContext<TLanguage>, languageContext: LanguageContextSpace): void;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the timezone for the given I18n context.
|
|
35
|
+
* @param context - The I18n context to modify
|
|
36
|
+
* @param timezone - The timezone to set
|
|
37
|
+
*/
|
|
38
|
+
export declare function setTimezone<TLanguage extends string>(context: I18nContext<TLanguage>, timezone: Timezone): void;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the admin timezone for the given I18n context.
|
|
41
|
+
* @param context - The I18n context to modify
|
|
42
|
+
* @param timezone - The admin timezone to set
|
|
43
|
+
*/
|
|
44
|
+
export declare function setAdminTimezone<TLanguage extends string>(context: I18nContext<TLanguage>, timezone: Timezone): void;
|
|
45
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,SAAS,SAAS,MAAM,EACpD,eAAe,EAAE,SAAS,EAC1B,cAAc,GAAE,oBAA8B,EAC9C,mBAAmB,GAAE,YAAsC,EAC3D,eAAe,GAAE,QAA8B,EAC/C,oBAAoB,GAAE,QAA8B,GACnD,WAAW,CAAC,SAAS,CAAC,CASxB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,SAAS,MAAM,EAClD,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,EAC/B,QAAQ,EAAE,SAAS,GAClB,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,MAAM,EACvD,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,EAC/B,QAAQ,EAAE,SAAS,GAClB,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,SAAS,SAAS,MAAM,EACjD,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,EAC/B,eAAe,EAAE,oBAAoB,GACpC,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,SAAS,MAAM,EAClD,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,EAC/B,QAAQ,EAAE,QAAQ,GACjB,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,SAAS,MAAM,EACvD,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,EAC/B,QAAQ,EAAE,QAAQ,GACjB,IAAI,CAEN"}
|
package/src/context.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createContext = createContext;
|
|
4
|
+
exports.setLanguage = setLanguage;
|
|
5
|
+
exports.setAdminLanguage = setAdminLanguage;
|
|
6
|
+
exports.setContext = setContext;
|
|
7
|
+
exports.setTimezone = setTimezone;
|
|
8
|
+
exports.setAdminTimezone = setAdminTimezone;
|
|
9
|
+
const currency_code_1 = require("./currency-code");
|
|
10
|
+
const timezone_1 = require("./timezone");
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new I18n context with default values.
|
|
13
|
+
* @param defaultLanguage - The default language for the context
|
|
14
|
+
* @param defaultContext - The default language context
|
|
15
|
+
* @param defaultCurrencyCode - The default currency code (defaults to USD)
|
|
16
|
+
* @param defaultTimezone - The default timezone (defaults to UTC)
|
|
17
|
+
* @param defaultAdminTimezone - The default admin timezone (defaults to UTC)
|
|
18
|
+
* @returns A new I18nContext instance
|
|
19
|
+
*/
|
|
20
|
+
function createContext(defaultLanguage, defaultContext = 'admin', defaultCurrencyCode = new currency_code_1.CurrencyCode('USD'), defaultTimezone = new timezone_1.Timezone('UTC'), defaultAdminTimezone = new timezone_1.Timezone('UTC')) {
|
|
21
|
+
return {
|
|
22
|
+
language: defaultLanguage,
|
|
23
|
+
adminLanguage: defaultLanguage,
|
|
24
|
+
currencyCode: defaultCurrencyCode,
|
|
25
|
+
currentContext: defaultContext,
|
|
26
|
+
timezone: defaultTimezone,
|
|
27
|
+
adminTimezone: defaultAdminTimezone,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sets the language for the given I18n context.
|
|
32
|
+
* @param context - The I18n context to modify
|
|
33
|
+
* @param language - The language to set
|
|
34
|
+
*/
|
|
35
|
+
function setLanguage(context, language) {
|
|
36
|
+
context.language = language;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Sets the admin language for the given I18n context.
|
|
40
|
+
* @param context - The I18n context to modify
|
|
41
|
+
* @param language - The admin language to set
|
|
42
|
+
*/
|
|
43
|
+
function setAdminLanguage(context, language) {
|
|
44
|
+
context.adminLanguage = language;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sets the current context for the given I18n context.
|
|
48
|
+
* @param context - The I18n context to modify
|
|
49
|
+
* @param languageContext - The language context to set
|
|
50
|
+
*/
|
|
51
|
+
function setContext(context, languageContext) {
|
|
52
|
+
context.currentContext = languageContext;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Sets the timezone for the given I18n context.
|
|
56
|
+
* @param context - The I18n context to modify
|
|
57
|
+
* @param timezone - The timezone to set
|
|
58
|
+
*/
|
|
59
|
+
function setTimezone(context, timezone) {
|
|
60
|
+
context.timezone = timezone;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Sets the admin timezone for the given I18n context.
|
|
64
|
+
* @param context - The I18n context to modify
|
|
65
|
+
* @param timezone - The admin timezone to set
|
|
66
|
+
*/
|
|
67
|
+
function setAdminTimezone(context, timezone) {
|
|
68
|
+
context.adminTimezone = timezone;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/context.ts"],"names":[],"mappings":";;AAcA,sCAeC;AAOD,kCAKC;AAOD,4CAKC;AAOD,gCAKC;AAOD,kCAKC;AAOD,4CAKC;AAzFD,mDAA+C;AAE/C,yCAAsC;AAGtC;;;;;;;;GAQG;AACH,SAAgB,aAAa,CAC3B,eAA0B,EAC1B,iBAAuC,OAAO,EAC9C,sBAAoC,IAAI,4BAAY,CAAC,KAAK,CAAC,EAC3D,kBAA4B,IAAI,mBAAQ,CAAC,KAAK,CAAC,EAC/C,uBAAiC,IAAI,mBAAQ,CAAC,KAAK,CAAC;IAEpD,OAAO;QACL,QAAQ,EAAE,eAAe;QACzB,aAAa,EAAE,eAAe;QAC9B,YAAY,EAAE,mBAAmB;QACjC,cAAc,EAAE,cAAc;QAC9B,QAAQ,EAAE,eAAe;QACzB,aAAa,EAAE,oBAAoB;KACpC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CACzB,OAA+B,EAC/B,QAAmB;IAEnB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,OAA+B,EAC/B,QAAmB;IAEnB,OAAO,CAAC,aAAa,GAAG,QAAQ,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CACxB,OAA+B,EAC/B,eAAqC;IAErC,OAAO,CAAC,cAAc,GAAG,eAAe,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CACzB,OAA+B,EAC/B,QAAkB;IAElB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,OAA+B,EAC/B,QAAkB;IAElB,OAAO,CAAC,aAAa,GAAG,QAAQ,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core I18n component with default languages and system strings
|
|
3
|
+
*/
|
|
4
|
+
import { ComponentDefinition } from './component-definition';
|
|
5
|
+
import { ComponentRegistration } from './component-registration';
|
|
6
|
+
import { CoreStringKey } from './core-string-key';
|
|
7
|
+
import { LanguageCodes } from './language-codes';
|
|
8
|
+
import { LanguageDefinition } from './language-definition';
|
|
9
|
+
import { PluginI18nEngine } from './plugin-i18n-engine';
|
|
10
|
+
/**
|
|
11
|
+
* Core language code type - union of supported language codes
|
|
12
|
+
* Provides compile-time type safety for core languages
|
|
13
|
+
* For custom languages, extend this type or use string
|
|
14
|
+
*/
|
|
15
|
+
export type CoreLanguageCode = typeof LanguageCodes[keyof typeof LanguageCodes];
|
|
16
|
+
/**
|
|
17
|
+
* Flexible language code type - use when you want runtime-only validation
|
|
18
|
+
* Alias for string to indicate it's a language code
|
|
19
|
+
*/
|
|
20
|
+
export type FlexibleLanguageCode = string;
|
|
21
|
+
/**
|
|
22
|
+
* Create default language definitions
|
|
23
|
+
*/
|
|
24
|
+
export declare function createDefaultLanguages(): LanguageDefinition[];
|
|
25
|
+
export declare const CoreI18nComponentId = "core";
|
|
26
|
+
/**
|
|
27
|
+
* Core component definition
|
|
28
|
+
*/
|
|
29
|
+
export declare const CoreComponentDefinition: ComponentDefinition<CoreStringKey>;
|
|
30
|
+
/**
|
|
31
|
+
* Core component strings for all default languages
|
|
32
|
+
*/
|
|
33
|
+
export declare function createCoreComponentStrings(): import("./strict-types").CompleteComponentLanguageStrings<CoreStringKey, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Create core component registration
|
|
36
|
+
*/
|
|
37
|
+
export declare function createCoreComponentRegistration(): ComponentRegistration<CoreStringKey, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Get core language codes as array (for Mongoose enums, etc.)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getCoreLanguageCodes(): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Get core language definitions
|
|
44
|
+
*/
|
|
45
|
+
export declare function getCoreLanguageDefinitions(): LanguageDefinition[];
|
|
46
|
+
/**
|
|
47
|
+
* Create a pre-configured I18n engine with core components
|
|
48
|
+
* Returns engine with string type - use registry for language validation
|
|
49
|
+
*/
|
|
50
|
+
export declare function createCoreI18nEngine(instanceKey?: string): PluginI18nEngine<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Type alias for easier usage
|
|
53
|
+
*/
|
|
54
|
+
export type CoreI18nEngine = PluginI18nEngine<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Helper function to get core translation
|
|
57
|
+
*/
|
|
58
|
+
export declare function getCoreTranslation(stringKey: CoreStringKey, variables?: Record<string, string | number>, language?: string, instanceKey?: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Helper function to safely get core translation with fallback
|
|
61
|
+
*/
|
|
62
|
+
export declare function safeCoreTranslation(stringKey: CoreStringKey, variables?: Record<string, string | number>, language?: string, instanceKey?: string): string;
|
|
63
|
+
//# sourceMappingURL=core-i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-i18n.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/core-i18n.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,aAAa,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAI1C;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,EAAE,CA4C7D;AAED,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,mBAAmB,CAAC,aAAa,CAItE,CAAC;AAEF;;GAEG;AACH,wBAAgB,0BAA0B,qFAwbzC;AAED;;GAEG;AACH,wBAAgB,+BAA+B,IAAI,qBAAqB,CACtE,aAAa,EACb,MAAM,CACP,CAKA;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,kBAAkB,EAAE,CAEjE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,GAAE,MAA2B,GACvC,gBAAgB,CAAC,MAAM,CAAC,CAQ1B;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEtD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,aAAa,EACxB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAGR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,aAAa,EACxB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAMR"}
|