diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-07 16:48:33 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-07 16:48:33 +1200 |
commit | 6a4c94eac5b90a4c2dddaa93a8c106998f67a205 (patch) | |
tree | 61f8a069c1b9cececcff86d01492cc177ce150c5 /web/app.js | |
parent | 6eb1837b796f51bd2a84d091b706a7ae1d4952a0 (diff) | |
download | trackermap-server-6a4c94eac5b90a4c2dddaa93a8c106998f67a205.tar.gz trackermap-server-6a4c94eac5b90a4c2dddaa93a8c106998f67a205.tar.bz2 trackermap-server-6a4c94eac5b90a4c2dddaa93a8c106998f67a205.zip |
Start implementing localization
Diffstat (limited to 'web/app.js')
-rw-r--r-- | web/app.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web/app.js b/web/app.js index 9599373a6..7b007a982 100644 --- a/web/app.js +++ b/web/app.js @@ -18,6 +18,25 @@ Ext.Loader.setConfig({ disableCaching: false }); +{ + var available = { + 'en': true, + 'ru': true + }; + + 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); + } + + if (!(language in available)) { + language = 'en'; // default + } + + Ext.Loader.loadScript('/l10n/' + language + '.js'); +} + Ext.application({ name: 'Traccar', extend: 'Traccar.Application' |