aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2017-12-07 00:08:45 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2017-12-07 00:08:45 +0100
commit9733eaf85115444718a1f6a32b971d29bd54d0ca (patch)
tree0450747dc6e12f28305a9962bc0b6054f255ba91 /src
parentfix(Service): Fix transparent service background (diff)
downloadferdium-app-9733eaf85115444718a1f6a32b971d29bd54d0ca.tar.gz
ferdium-app-9733eaf85115444718a1f6a32b971d29bd54d0ca.tar.zst
ferdium-app-9733eaf85115444718a1f6a32b971d29bd54d0ca.zip
fix(i18n): Fallback to system language or english
Diffstat (limited to 'src')
-rw-r--r--src/config.js3
-rw-r--r--src/stores/AppStore.js8
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