diff options
author | Lauri Ojansivu <x@xet7.org> | 2017-03-30 08:06:44 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2017-03-30 08:06:44 +0300 |
commit | 3ce46159750ea41f0ca689afd340bbfde6f698e9 (patch) | |
tree | 0f600d207c1d476755bff737fdb3c253982e396e /client/lib | |
parent | 9d95a7ed4d103804b916326039a4d94bd0041c9d (diff) | |
parent | 82a5da61df9879799c1dfa056da35ae95ac1af70 (diff) | |
download | wekan-3ce46159750ea41f0ca689afd340bbfde6f698e9.tar.gz wekan-3ce46159750ea41f0ca689afd340bbfde6f698e9.tar.bz2 wekan-3ce46159750ea41f0ca689afd340bbfde6f698e9.zip |
Merge branch 'navigator-preferred-language' of https://github.com/umbertooo/wekan into umbertooo-navigator-preferred-language
Diffstat (limited to 'client/lib')
-rw-r--r-- | client/lib/i18n.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/client/lib/i18n.js b/client/lib/i18n.js index 34a789e1..4c02211a 100644 --- a/client/lib/i18n.js +++ b/client/lib/i18n.js @@ -6,10 +6,16 @@ Meteor.startup(() => { Tracker.autorun(() => { const currentUser = Meteor.user(); let language; - if (currentUser && currentUser.profile && currentUser.profile.language) { - language = currentUser.profile.language; - } else { - language = navigator.language || navigator.userLanguage; + if (currentUser) { + language = currentUser.profile && currentUser.profile.language; + } + + if (!language) { + if(navigator.languages) { + language = navigator.languages[0]; + } else { + language = navigator.language || navigator.userLanguage; + } } if (language) { |