From bc0f370821aebdf3c4482c3a3f579f3a6376e82e Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 27 May 2021 14:44:41 +0100 Subject: [PATCH] Fall back to instance properties --- src/language-helper.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/language-helper.js b/src/language-helper.js index e3a82313..0a41f69a 100644 --- a/src/language-helper.js +++ b/src/language-helper.js @@ -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(); }