Skip to content
Permalink
Browse files

fix(i18n): Fallback to system language or english

  • Loading branch information
adlk committed Dec 6, 2017
1 parent ed0098f commit 9733eaf85115444718a1f6a32b971d29bd54d0ca
Showing with 9 additions and 2 deletions.
  1. +2 −1 src/config.js
  2. +7 −1 src/stores/AppStore.js
@@ -14,7 +14,8 @@ export const DEFAULT_APP_SETTINGS = {
showMessageBadgeWhenMuted: true,
enableSpellchecking: true,
// spellcheckingLanguage: 'auto',
locale: 'en-US',
locale: '',
fallbackLocale: 'en-US',
beta: false,
isAppMuted: false,
};
@@ -255,8 +255,10 @@ export default class AppStore extends Store {
_setLocale() {
const locale = this.stores.settings.all.locale;

if (locale && locale !== this.locale) {
if (locale && Object.prototype.hasOwnProperty.call(locales, locale) && locale !== this.locale) {
this.locale = locale;
} else if (!locale) {
this.locale = this._getDefaultLocale();
}
}

@@ -281,6 +283,10 @@ export default class AppStore extends Store {
locale = defaultLocale;
}

if (!locale) {
locale = DEFAULT_APP_SETTINGS.fallbackLocale;
}

return locale;
}

0 comments on commit 9733eaf

Please sign in to comment.
You can’t perform that action at this time.