summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/lib/i18n.js31
1 files changed, 12 insertions, 19 deletions
diff --git a/client/lib/i18n.js b/client/lib/i18n.js
index b8b8609d..f2709d15 100644
--- a/client/lib/i18n.js
+++ b/client/lib/i18n.js
@@ -2,26 +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;
- }
-
- if (language) {
- TAPi18n.setLanguage(language);
+Meteor.startup(() => {
+ Tracker.autorun(() => {
+ const currentUser = Meteor.user();
+ let language;
+ if (currentUser) {
+ language = currentUser.profile && currentUser.profile.language;
+ } else {
+ language = navigator.language || navigator.userLanguage;
+ }
- // For languages such as Finnish (Suomi) that are not supported by meteor-accounts-t9n,
- // the following may throw an exception. On the initial run of this `autorun()` callback,
- // such an exception could cause the entire app to fail to load. Therefore, we catch
- // the exception and log it as an error.
- try {
+ if (language) {
+ TAPi18n.setLanguage(language);
T9n.setLanguage(language);
- } catch (e) {
- console.error(e);
}
- }
+ });
});