|
|
|
@ -1,11 +1,6 @@
|
|
|
|
|
(function () {
|
|
|
|
|
var LS_LANG = "CRYPTPAD_LANG";
|
|
|
|
|
|
|
|
|
|
var getStoredLanguage = function () { return localStorage.getItem(LS_LANG); };
|
|
|
|
|
var getBrowserLanguage = function () { return navigator.language || navigator.userLanguage; };
|
|
|
|
|
var getLanguage = function () { return getStoredLanguage() || getBrowserLanguage(); };
|
|
|
|
|
var language = getLanguage();
|
|
|
|
|
|
|
|
|
|
// add your module to this map so it gets used
|
|
|
|
|
var map = {
|
|
|
|
|
'fr': 'Français',
|
|
|
|
@ -15,6 +10,19 @@ var map = {
|
|
|
|
|
'pt-br': 'Português do Brasil'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var getStoredLanguage = function () { return localStorage.getItem(LS_LANG); };
|
|
|
|
|
var getBrowserLanguage = function () { return navigator.language || navigator.userLanguage; };
|
|
|
|
|
var getLanguage = function () {
|
|
|
|
|
if (getStoredLanguage()) { return getStoredLanguage(); }
|
|
|
|
|
var l = getBrowserLanguage() || '';
|
|
|
|
|
if (Object.keys(map).indexOf(l) !== -1) {
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
// Edge returns 'fr-FR' --> transform it to 'fr' and check again
|
|
|
|
|
return Object.keys(map).indexOf(l.split('-')[0]) !== -1 ? l.split('-')[0] : 'en';
|
|
|
|
|
};
|
|
|
|
|
var language = getLanguage();
|
|
|
|
|
|
|
|
|
|
var req = ['/customize/translations/messages.js'];
|
|
|
|
|
if (language && map[language]) { req.push('/customize/translations/messages.' + language + '.js'); }
|
|
|
|
|
req.push('/bower_components/jquery/dist/jquery.min.js');
|
|
|
|
|