mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00

* Remove the i18n initialization code from an `autorun()` block * Add some console statements to help with debugging production. * Add functions to `Boards` for label colors and color mapping
27 lines
818 B
JavaScript
27 lines
818 B
JavaScript
// We save the user language preference in the user profile, and use that to set
|
|
// the language reactively. If the user is not connected we use the language
|
|
// information provided by the browser, and default to english.
|
|
|
|
Meteor.startup(() => {
|
|
TAPi18n.conf.i18n_files_route = Meteor._relativeToSiteRootUrl('/tap-i18n');
|
|
const currentUser = Meteor.user();
|
|
let language;
|
|
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) {
|
|
TAPi18n.setLanguage(language);
|
|
// eslint-disable-next-line no-console
|
|
console.log('language set!');
|
|
T9n.setLanguage(language);
|
|
}
|
|
});
|