The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
wekan/client/lib/i18n.js

30 lines
957 B

import { TAPi18n } from '/imports/i18n';
// 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(() => {
const currentUser = Meteor.user();
// Select first available language
const [language] = [
// User profile
currentUser?.profile?.language,
// Browser locale
navigator.languages?.at(0),
navigator.language,
navigator.userLanguage,
].filter(Boolean);
if (language) {
// Try with potentially complex language tag
if (TAPi18n.isLanguageSupported(language)) {
TAPi18n.setLanguage(language);
} else if (language.includes('-')) {
// Fallback to a general language
const [general] = language.split('-');
if (TAPi18n.isLanguageSupported(general)) {
TAPi18n.setLanguage(general);
}
}
}
});