@digitaldefiance/i18n-lib 1.0.7 → 1.0.8
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 +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/i18n-engine.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { I18nConfig, I18nContext, EnumLanguageTranslation } from './types';
|
|
2
|
-
export declare class I18nEngine<TStringKey extends string, TLanguage extends string
|
|
2
|
+
export declare class I18nEngine<TStringKey extends string, TLanguage extends string, TConstants = Record<string, string | number>> {
|
|
3
3
|
private config;
|
|
4
4
|
private enumRegistry;
|
|
5
|
-
constructor(config: I18nConfig<TStringKey, TLanguage>);
|
|
5
|
+
constructor(config: I18nConfig<TStringKey, TLanguage, TConstants>);
|
|
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
8
|
registerEnum<TEnum extends string | number>(enumObj: Record<string, TEnum> | Record<string | number, string | number>, translations: EnumLanguageTranslation<TEnum, TLanguage>, enumName: string): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ export type StringsCollection<TStringKey extends string> = Partial<Record<TStrin
|
|
|
4
4
|
export type MasterStringsCollection<TStringKey extends string, TLanguage extends string> = Partial<Record<TLanguage, StringsCollection<TStringKey>>>;
|
|
5
5
|
export type LanguageCodeCollection<TLanguage extends string> = Partial<Record<TLanguage, string>>;
|
|
6
6
|
export type EnumTranslationMap<TEnum extends string | number, TLanguage extends string> = Partial<Record<TLanguage, Partial<Record<TEnum, string>>>>;
|
|
7
|
-
export interface I18nConfig<TStringKey extends string, TLanguage extends string
|
|
7
|
+
export interface I18nConfig<TStringKey extends string, TLanguage extends string, TConstants = Record<string, string | number>> {
|
|
8
8
|
strings: MasterStringsCollection<TStringKey, TLanguage>;
|
|
9
9
|
defaultLanguage: TLanguage;
|
|
10
10
|
languageCodes: LanguageCodeCollection<TLanguage>;
|
|
11
|
-
constants?:
|
|
11
|
+
constants?: TConstants;
|
|
12
12
|
}
|
|
13
13
|
export interface I18nContext<TLanguage extends string> {
|
|
14
14
|
language: TLanguage;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function replaceVariables(str: string, vars?: Record<string, string | number>, constants?:
|
|
1
|
+
export declare function replaceVariables(str: string, vars?: Record<string, string | number>, constants?: any): string;
|
|
2
2
|
export declare function isTemplate(key: string): boolean;
|