diff options
author | Lauri Ojansivu <x@xet7.org> | 2016-11-15 23:35:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-15 23:35:30 +0200 |
commit | 0733fd64eee199633092702bb6bd330a38352f19 (patch) | |
tree | 6dc39805ba196390bda29836639824459d53d033 /client/lib | |
parent | afca7ce6dab51636b5a6bf9e50719c3d0dc47f4d (diff) | |
parent | 4b248151c3b1fbb763b5d95cd729fc99828be382 (diff) | |
download | wekan-0733fd64eee199633092702bb6bd330a38352f19.tar.gz wekan-0733fd64eee199633092702bb6bd330a38352f19.tar.bz2 wekan-0733fd64eee199633092702bb6bd330a38352f19.zip |
Merge pull request #4 from dwrensha/t9n-set-language
Fix failure to load when navigator.language is Chinese or Finnish.
Diffstat (limited to 'client/lib')
-rw-r--r-- | client/lib/i18n.js | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/client/lib/i18n.js b/client/lib/i18n.js index a03fb398..34a789e1 100644 --- a/client/lib/i18n.js +++ b/client/lib/i18n.js @@ -2,20 +2,19 @@ // the language reactively. If the user is not connected we use the language // information provided by the browser, and default to english. -Tracker.autorun(() => { - const currentUser = Meteor.user(); - let language; - if (currentUser) { - language = currentUser.profile && currentUser.profile.language; - } else { - language = navigator.language || navigator.userLanguage; - } +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 (language) { - TAPi18n.setLanguage(language); - - // XXX - const shortLanguage = language.split('-')[0]; - T9n.setLanguage(shortLanguage); - } + if (language) { + TAPi18n.setLanguage(language); + T9n.setLanguage(language); + } + }); }); |