summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/i18n.js29
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);
+ }
+ });
});