Skip to content

Commit 8f8708c

Browse files
Fix loading of default/backup translations
1 parent 43c071b commit 8f8708c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

public/scripts/localization.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ class Localization {
5151
}
5252

5353
async setInitialTranslation() {
54+
await Localization.fetchDefaultTranslations();
5455
await Localization.setTranslation(Localization.initialLocale)
5556
}
5657

5758
static async setTranslation(locale) {
5859
if (!locale) locale = Localization.systemLocale;
5960

60-
await Localization.setLocale(locale)
61+
await Localization.fetchTranslations(locale)
6162
await Localization.translatePage();
6263

6364
if (Localization.localeIsRtl(locale)) {
@@ -78,10 +79,12 @@ class Localization {
7879
Events.fire("translation-loaded");
7980
}
8081

81-
static async setLocale(newLocale) {
82-
if (newLocale === Localization.locale) return false;
82+
static async fetchDefaultTranslations() {
83+
Localization.translationsDefaultLocale = await Localization.fetchTranslationsFor(Localization.defaultLocale);
84+
}
8385

84-
Localization.defaultTranslations = await Localization.fetchTranslationsFor(Localization.defaultLocale);
86+
static async fetchTranslations(newLocale) {
87+
if (newLocale === Localization.locale) return false;
8588

8689
const newTranslations = await Localization.fetchTranslationsFor(newLocale);
8790

0 commit comments

Comments
 (0)