summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorFelix Michels <felix.michels@deutschebahn.com>2016-10-19 15:44:24 +0200
committerFelix Michels <felix.michels@deutschebahn.com>2016-10-19 15:57:14 +0200
commit82a5da61df9879799c1dfa056da35ae95ac1af70 (patch)
tree76d66f8f63c6d4ea428841e6e3f147f09b7e997d /client
parentb90d668fbc28f931bf8cdf536311ed1bf2d7d2a7 (diff)
downloadwekan-82a5da61df9879799c1dfa056da35ae95ac1af70.tar.gz
wekan-82a5da61df9879799c1dfa056da35ae95ac1af70.tar.bz2
wekan-82a5da61df9879799c1dfa056da35ae95ac1af70.zip
Use the navigator's language properties even if a user exists but the user has not yet choosen a profile language. If the browser provides multiple preferred languages via `navigator.languages`, select the most-preferred one.
WKN-47
Diffstat (limited to 'client')
-rw-r--r--client/lib/i18n.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/lib/i18n.js b/client/lib/i18n.js
index a03fb398..e49a0001 100644
--- a/client/lib/i18n.js
+++ b/client/lib/i18n.js
@@ -7,8 +7,14 @@ Tracker.autorun(() => {
let language;
if (currentUser) {
language = currentUser.profile && currentUser.profile.language;
- } else {
- language = navigator.language || navigator.userLanguage;
+ }
+
+ if (!language) {
+ if(navigator.languages) {
+ language = navigator.languages[0];
+ } else {
+ language = navigator.language || navigator.userLanguage;
+ }
}
if (language) {