Fall back to instance properties

This commit is contained in:
J. Ryan Stinnett 2021-05-27 14:44:41 +01:00
parent 1455687384
commit bc0f370821

View file

@ -56,10 +56,10 @@ function _t(text, variables = {}) {
}
class AppLocalization {
static STORE_KEY = "locale"
store = null
constructor({ store, components = [] }) {
// TODO: Should be static field, but that doesn't parse without Babel
this.STORE_KEY = "locale";
counterpart.registerTranslations("en", this.fetchTranslationJson("en_EN"));
counterpart.setFallbackLocale('en');
counterpart.setSeparator('|');
@ -69,8 +69,8 @@ class AppLocalization {
}
this.store = store;
if (this.store.has(AppLocalization.STORE_KEY)) {
const locales = this.store.get(AppLocalization.STORE_KEY);
if (this.store.has(this.STORE_KEY)) {
const locales = this.store.get(this.STORE_KEY);
this.setAppLocale(locales);
}
@ -106,7 +106,7 @@ class AppLocalization {
});
counterpart.setLocale(locales);
this.store.set(AppLocalization.STORE_KEY, locales);
this.store.set(this.STORE_KEY, locales);
this.resetLocalizedUI();
}