diff options
Diffstat (limited to 'web/locale.js')
-rw-r--r-- | web/locale.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/web/locale.js b/web/locale.js index 43558d732..d200891d5 100644 --- a/web/locale.js +++ b/web/locale.js @@ -14,11 +14,13 @@ * limitations under the License. */ +var Locale = {}; + Ext.Loader.setConfig({ disableCaching: false }); -var availableLanguages = { +Locale.languages = { 'bg': { name: 'Български', code: 'bg' }, 'cs': { name: 'Čeština', code: 'cs' }, 'de': { name: 'Deutsch', code: 'de' }, @@ -39,15 +41,15 @@ var availableLanguages = { 'zh': { name: '中文', code: 'zh_CN' } }; -var language = Ext.Object.fromQueryString(window.location.search.substring(1)).locale; -if (language === undefined) { - language = window.navigator.userLanguage || window.navigator.language; - language = language.substr(0, 2); +Locale.language = Ext.Object.fromQueryString(window.location.search.substring(1)).locale; +if (Locale.language === undefined) { + Locale.language = window.navigator.userLanguage || window.navigator.language; + Locale.language = Locale.language.substr(0, 2); } -if (!(language in availableLanguages)) { - language = 'en'; // default +if (!(Locale.language in Locale.languages)) { + Locale.language = 'en'; // default } -Ext.Loader.loadScript('/l10n/' + language + '.js'); -Ext.Loader.loadScript('//cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/locale/locale-' + availableLanguages[language].code + '.js'); +Ext.Loader.loadScript('/l10n/' + Locale.language + '.js'); +Ext.Loader.loadScript('//cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/locale/locale-' + Locale.languages[Locale.language].code + '.js'); |