diff options
author | Stefan Malzner <stefan@adlk.io> | 2017-12-07 00:08:45 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2017-12-07 00:08:45 +0100 |
commit | 9733eaf85115444718a1f6a32b971d29bd54d0ca (patch) | |
tree | 0450747dc6e12f28305a9962bc0b6054f255ba91 | |
parent | fix(Service): Fix transparent service background (diff) | |
download | ferdium-app-9733eaf85115444718a1f6a32b971d29bd54d0ca.tar.gz ferdium-app-9733eaf85115444718a1f6a32b971d29bd54d0ca.tar.zst ferdium-app-9733eaf85115444718a1f6a32b971d29bd54d0ca.zip |
fix(i18n): Fallback to system language or english
-rw-r--r-- | src/config.js | 3 | ||||
-rw-r--r-- | src/stores/AppStore.js | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/config.js b/src/config.js index e6d8958e6..e66594c59 100644 --- a/src/config.js +++ b/src/config.js | |||
@@ -14,7 +14,8 @@ export const DEFAULT_APP_SETTINGS = { | |||
14 | showMessageBadgeWhenMuted: true, | 14 | showMessageBadgeWhenMuted: true, |
15 | enableSpellchecking: true, | 15 | enableSpellchecking: true, |
16 | // spellcheckingLanguage: 'auto', | 16 | // spellcheckingLanguage: 'auto', |
17 | locale: 'en-US', | 17 | locale: '', |
18 | fallbackLocale: 'en-US', | ||
18 | beta: false, | 19 | beta: false, |
19 | isAppMuted: false, | 20 | isAppMuted: false, |
20 | }; | 21 | }; |
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 17ec832cf..dcdb11a12 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -255,8 +255,10 @@ export default class AppStore extends Store { | |||
255 | _setLocale() { | 255 | _setLocale() { |
256 | const locale = this.stores.settings.all.locale; | 256 | const locale = this.stores.settings.all.locale; |
257 | 257 | ||
258 | if (locale && locale !== this.locale) { | 258 | if (locale && Object.prototype.hasOwnProperty.call(locales, locale) && locale !== this.locale) { |
259 | this.locale = locale; | 259 | this.locale = locale; |
260 | } else if (!locale) { | ||
261 | this.locale = this._getDefaultLocale(); | ||
260 | } | 262 | } |
261 | } | 263 | } |
262 | 264 | ||
@@ -281,6 +283,10 @@ export default class AppStore extends Store { | |||
281 | locale = defaultLocale; | 283 | locale = defaultLocale; |
282 | } | 284 | } |
283 | 285 | ||
286 | if (!locale) { | ||
287 | locale = DEFAULT_APP_SETTINGS.fallbackLocale; | ||
288 | } | ||
289 | |||
284 | return locale; | 290 | return locale; |
285 | } | 291 | } |
286 | 292 | ||