summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/codeq/core.js11
-rw-r--r--js/codeq/login.js6
-rw-r--r--js/codeq/settings.js4
3 files changed, 11 insertions, 10 deletions
diff --git a/js/codeq/core.js b/js/codeq/core.js
index 8d7900d..6b76042 100644
--- a/js/codeq/core.js
+++ b/js/codeq/core.js
@@ -165,8 +165,7 @@
return html.replace(regexpWhiteSpaceBeforeTag, '').split(regexpWhiteSpaceAfterTag).join('>');
};
- var lang = 'en', // this is overridden in the boot sequence below, if the browser uses a supported language
- resources = {}; // resource tree, loaded from data/resources.json in the boot sequence
+ var resources = {}; // resource tree, loaded from data/resources.json in the boot sequence
// event dispatch
var eventListeners = {}, // keyed by event name, value is an array of listeners
@@ -386,7 +385,9 @@
'log': log,
- 'settings': {},
+ 'settings': {
+ 'gui_lang': 'en' // boot sequence overrides this if the browser uses a supported language
+ },
'availableLangs': [], // filled at boot from 'supportedLangs'
'supportedLangs': {
@@ -395,11 +396,11 @@
},
'isWebApp': false, // this is a PhoneGap/Cordova build, will be overridden in cordova.js for webapp
'getLang': function () {
- return lang;
+ return codeq.settings['gui_lang'];
},
'setLang': function (newLang) {
- lang = newLang;
+ codeq.settings['gui_lang'] = newLang;
codeq.fire('langchange', {'lang': newLang});
},
diff --git a/js/codeq/login.js b/js/codeq/login.js
index c1f1bd9..d127fe3 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -26,9 +26,9 @@
//merge these settings into the already existing default settings
var sett = data.settings;
$.extend(codeq.settings, sett);
- if('lang' in sett && sett['lang'] in codeq.supportedLangs){
- codeq.setLang(sett['lang']);
- $("#gui_lang_select").val(sett['lang']);
+ if('gui_lang' in sett && sett['gui_lang'] in codeq.supportedLangs){
+ codeq.setLang(sett['gui_lang']);
+ $("#gui_lang_select").val(sett['gui_lang']);
}
codeq.globalStateMachine.transition('language');
diff --git a/js/codeq/settings.js b/js/codeq/settings.js
index 9eb4366..252a2ea 100644
--- a/js/codeq/settings.js
+++ b/js/codeq/settings.js
@@ -25,7 +25,7 @@
if(closedWithSave){
var lang = $("#gui_lang_select").val();
if (lang in codeq.supportedLangs) {
- codeq.comms.updateSettings({'lang': lang})
+ codeq.comms.updateSettings({'gui_lang': lang})
.then(function (data) {
if (data.code !== 0) throw new Error('Change language failed, code: ' + data.code + ', message: ' + data.message);//error msg if something went wring while saving to db
})
@@ -36,4 +36,4 @@
if (previousLang in codeq.supportedLangs) codeq.setLang(previousLang);
}
});
-})(); \ No newline at end of file
+})();