|
@@ -66,7 +66,8 @@ class NCoreUIKitLocalize<T extends LocalizeType> extends NCoreContext<LocalizeCo
|
|
|
localize: () => "Localization is loading...",
|
|
localize: () => "Localization is loading...",
|
|
|
translations: initialLanguage.translations,
|
|
translations: initialLanguage.translations,
|
|
|
rruleConfig: initialLanguage.rruleConfig,
|
|
rruleConfig: initialLanguage.rruleConfig,
|
|
|
- isRTL: initialLanguage.isRTL
|
|
|
|
|
|
|
+ isRTL: initialLanguage.isRTL,
|
|
|
|
|
+ localeKeys: []
|
|
|
}, {
|
|
}, {
|
|
|
key: "NCoreUIKitLocalize"
|
|
key: "NCoreUIKitLocalize"
|
|
|
});
|
|
});
|
|
@@ -88,6 +89,7 @@ class NCoreUIKitLocalize<T extends LocalizeType> extends NCoreContext<LocalizeCo
|
|
|
const defaultLocale = defaultLocalesData.find(l => l.locale === locale) ?? defaultLocalesData[0]!;
|
|
const defaultLocale = defaultLocalesData.find(l => l.locale === locale) ?? defaultLocalesData[0]!;
|
|
|
|
|
|
|
|
const defaultState: LocalizeContextStateType = {
|
|
const defaultState: LocalizeContextStateType = {
|
|
|
|
|
+ localeKeys: defaultLocalesData.map(lDI => lDI.locale) as Array<keyof NCoreUIKit.LocaleKey>,
|
|
|
activeLocale: defaultLocale.locale as keyof NCoreUIKit.LocaleKey,
|
|
activeLocale: defaultLocale.locale as keyof NCoreUIKit.LocaleKey,
|
|
|
// localizeWithObject: this.localizeWithObject,
|
|
// localizeWithObject: this.localizeWithObject,
|
|
|
translations: defaultLocale.translations,
|
|
translations: defaultLocale.translations,
|
|
@@ -106,8 +108,14 @@ class NCoreUIKitLocalize<T extends LocalizeType> extends NCoreContext<LocalizeCo
|
|
|
return defaultState;
|
|
return defaultState;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const dLKeys = [...new Set([
|
|
|
|
|
+ ...defaultLocalesData.map(p => p.locale),
|
|
|
|
|
+ ...this.projectLocales.map(p => p.locale)
|
|
|
|
|
+ ])];
|
|
|
|
|
+
|
|
|
const newState: LocalizeContextStateType = {
|
|
const newState: LocalizeContextStateType = {
|
|
|
activeLocale: currentProjectLocale.locale as keyof NCoreUIKit.LocaleKey,
|
|
activeLocale: currentProjectLocale.locale as keyof NCoreUIKit.LocaleKey,
|
|
|
|
|
+ localeKeys: dLKeys as Array<keyof NCoreUIKit.LocaleKey>,
|
|
|
// localizeWithObject: this.localizeWithObject,
|
|
// localizeWithObject: this.localizeWithObject,
|
|
|
rruleConfig: {
|
|
rruleConfig: {
|
|
|
...defaultLocale.rruleConfig,
|
|
...defaultLocale.rruleConfig,
|