diff --git a/apps/common/locale.js b/apps/common/locale.js index 9cf5cbf96..d954165fc 100644 --- a/apps/common/locale.js +++ b/apps/common/locale.js @@ -38,7 +38,8 @@ Common.Locale = new(function() { "use strict"; var l10n = null; var loadcallback, - apply = false; + apply = false, + currentLang = 'en'; var _applyLocalization = function(callback) { try { @@ -78,6 +79,10 @@ Common.Locale = new(function() { return res || (scope ? eval(scope.name).prototype[prop] : ''); }; + var _getCurrentLanguage = function() { + return (currentLang || 'en'); + }; + var _getUrlParameterByName = function(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), @@ -87,9 +92,11 @@ Common.Locale = new(function() { var _requireLang = function () { var lang = (_getUrlParameterByName('lang') || 'en').split(/[\-_]/)[0]; + currentLang = lang; fetch('locale/' + lang + '.json') .then(function(response) { if (!response.ok) { + currentLang = 'en'; if (lang != 'en') /* load default lang if fetch failed */ return fetch('locale/en.json'); @@ -130,7 +137,8 @@ Common.Locale = new(function() { return { apply: _applyLocalization, - get: _get + get: _get, + getCurrentLanguage: _getCurrentLanguage }; })(); diff --git a/apps/common/main/lib/component/CheckBox.js b/apps/common/main/lib/component/CheckBox.js index 019c1013f..c42f26253 100644 --- a/apps/common/main/lib/component/CheckBox.js +++ b/apps/common/main/lib/component/CheckBox.js @@ -94,7 +94,8 @@ define([ checked : false, value : 'unchecked', - template : _.template(''), + template : _.template('