Fix an issue with updating translations
This commit is contained in:
parent
4cfba71c16
commit
799b61f6a7
|
@ -16,20 +16,20 @@ export default new class LocaleManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
this.setLocale(this.discordLocale);
|
this.setLocale();
|
||||||
LocaleStore?.addChangeListener((newLocale) => this.setLocale(newLocale));
|
LocaleStore?.addChangeListener(() => this.setLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
setLocale(newLocale) {
|
setLocale() {
|
||||||
let newStrings;
|
let newStrings;
|
||||||
if (newLocale != this.defaultLocale) {
|
if (this.discordLocale != this.defaultLocale) {
|
||||||
newStrings = Locales[newLocale];
|
newStrings = Locales[this.discordLocale];
|
||||||
if (!newStrings) return this.setLocale(this.defaultLocale);
|
if (!newStrings) return this.setLocale(this.defaultLocale);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newStrings = Locales[this.defaultLocale];
|
newStrings = Locales[this.defaultLocale];
|
||||||
}
|
}
|
||||||
this.locale = newLocale;
|
this.locale = this.discordLocale;
|
||||||
Utilities.extendTruthy(this.strings, newStrings);
|
Utilities.extendTruthy(this.strings, newStrings);
|
||||||
Events.emit("strings-updated");
|
Events.emit("strings-updated");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue