mirror of
https://github.com/vector-im/element-desktop.git
synced 2024-07-04 05:23:28 +00:00
Change type for translations in element-desktop
This commit is contained in:
parent
cfa26d22a3
commit
82a20371dc
|
@ -113,7 +113,7 @@ export class AppLocalization {
|
|||
return parts.join("_");
|
||||
}
|
||||
|
||||
public fetchTranslationJson(locale: string): Record<string, string> | null {
|
||||
public fetchTranslationJson(locale: string): object | null {
|
||||
try {
|
||||
console.log(`Fetching translation json for locale: ${locale}`);
|
||||
return loadJsonFile(__dirname, "i18n", "strings", `${locale}.json`);
|
||||
|
@ -130,13 +130,16 @@ export class AppLocalization {
|
|||
locales = [locales];
|
||||
}
|
||||
|
||||
const loadedLocales = locales.flatMap(this.variations).map(this.denormalize).filter((locale) => {
|
||||
const translations = this.fetchTranslationJson(locale);
|
||||
if (translations !== null) {
|
||||
counterpart.registerTranslations(locale, translations);
|
||||
}
|
||||
return !!translations;
|
||||
});
|
||||
const loadedLocales = locales
|
||||
.flatMap(this.variations)
|
||||
.map(this.denormalize)
|
||||
.filter((locale) => {
|
||||
const translations = this.fetchTranslationJson(locale);
|
||||
if (translations !== null) {
|
||||
counterpart.registerTranslations(locale, translations);
|
||||
}
|
||||
return !!translations;
|
||||
});
|
||||
|
||||
counterpart.setLocale(loadedLocales[0]);
|
||||
this.store.set(AppLocalization.STORE_KEY, locales);
|
||||
|
|
Loading…
Reference in a new issue