aboutsummaryrefslogtreecommitdiff
path: root/web/locale.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-03 21:51:50 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-03 21:51:50 +1300
commita7a2174c927d27eead9139eb9ff65dc87d7eefbc (patch)
tree99c422313f6c11f296b3ec43150da63e87dcaa17 /web/locale.js
parent8416025e932669550c166cfc4263d55c149eed89 (diff)
downloadtrackermap-server-a7a2174c927d27eead9139eb9ff65dc87d7eefbc.tar.gz
trackermap-server-a7a2174c927d27eead9139eb9ff65dc87d7eefbc.tar.bz2
trackermap-server-a7a2174c927d27eead9139eb9ff65dc87d7eefbc.zip
Fix remaining jshint warnings
Diffstat (limited to 'web/locale.js')
-rw-r--r--web/locale.js20
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');