@digitaldefiance/i18n-lib 1.0.4 → 1.0.6
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/dist/i18n-engine.d.ts +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/utils.d.ts +3 -1
- package/package.json +2 -2
package/dist/i18n-engine.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class I18nEngine<TStringKey extends string, TLanguage extends str
|
|
|
5
5
|
constructor(config: I18nConfig<TStringKey, TLanguage>);
|
|
6
6
|
translate(key: TStringKey, context: I18nContext<TLanguage>, vars?: Record<string, string | number>, language?: TLanguage, fallbackLanguage?: TLanguage): string;
|
|
7
7
|
translateEnum<TEnum extends string | number>(enumObj: Record<string, TEnum>, value: TEnum, language: TLanguage): string;
|
|
8
|
-
registerEnum<TEnum extends string | number>(enumObj: Record<string, TEnum>, translations: EnumLanguageTranslation<TEnum, TLanguage>, enumName: string): void;
|
|
8
|
+
registerEnum<TEnum extends string | number>(enumObj: Record<string, TEnum> | Record<string | number, string | number>, translations: EnumLanguageTranslation<TEnum, TLanguage>, enumName: string): void;
|
|
9
9
|
private getString;
|
|
10
10
|
getLanguageCode(language: TLanguage): string;
|
|
11
11
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ export interface I18nConfig<TStringKey extends string, TLanguage extends string>
|
|
|
8
8
|
strings: MasterStringsCollection<TStringKey, TLanguage>;
|
|
9
9
|
defaultLanguage: TLanguage;
|
|
10
10
|
languageCodes: LanguageCodeCollection<TLanguage>;
|
|
11
|
-
constants?: Record<string, string | number
|
|
11
|
+
constants?: Record<string, string | number> | {
|
|
12
|
+
[key: string]: string | number | RegExp | bigint;
|
|
13
|
+
};
|
|
12
14
|
}
|
|
13
15
|
export interface I18nContext<TLanguage extends string> {
|
|
14
16
|
language: TLanguage;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export declare function replaceVariables(str: string, vars?: Record<string, string | number>, constants?: Record<string, string | number>
|
|
1
|
+
export declare function replaceVariables(str: string, vars?: Record<string, string | number>, constants?: Record<string, string | number> | {
|
|
2
|
+
[key: string]: string | number | RegExp | bigint;
|
|
3
|
+
}): string;
|
|
2
4
|
export declare function isTemplate(key: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/i18n-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Generic i18n library with enum translation support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "yarn tsc",
|
|
9
9
|
"test": "yarn jest",
|
|
10
10
|
"prepublishOnly": "yarn build",
|
|
11
|
-
"publish": "npm publish --access public"
|
|
11
|
+
"publish:public": "npm publish --access public"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/jest": "^29.0.0",
|