summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/codeq/login.js2
-rw-r--r--js/codeq/translation.js25
2 files changed, 19 insertions, 8 deletions
diff --git a/js/codeq/login.js b/js/codeq/login.js
index a33eb20..32b821d 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -16,7 +16,7 @@
if (data.code !== 0) throw new Error('Login failed, code: ' + data.code + ', message: ' + data.message);
//nav signed in...
- $('#signed-in-title').html('Signed in as '+(data.name||$('#username').val()));
+ $('#signed-in-title').html(data.name||$('#username').val());
//merge with profile page
$('#profileUsername').html($('#username').val());
$('#profileName').html(data.name||'undefined');
diff --git a/js/codeq/translation.js b/js/codeq/translation.js
index 154358a..f0c8aab 100644
--- a/js/codeq/translation.js
+++ b/js/codeq/translation.js
@@ -1,11 +1,11 @@
(function () {
var dicts = {},
- translateElement = function (jqElt, lang) {
+ translateElement = function (jqElt, tkey, lang) {
var dictionaryKey = jqElt.data('dict') || 'gui',
- translationKey = jqElt.data('tkey'),
+ translationKey = jqElt.data(tkey),
dict = dicts[dictionaryKey],
- translations, html, key;
+ translations, html, key, att;
if (dict === codeq.tr.emptyDictionary) return; // silent ignore
if (!dict) {
codeq.log.error('Cannot find translation dictionary ' + dictionaryKey);
@@ -40,11 +40,22 @@
}
}
}
- jqElt.html(html);
+ att = tkey.substring(5);
+ if (att) jqElt.attr(att,html);
+ else jqElt.html(html);
},
translateDocument = function (lang) {
$('[data-tkey]').each(function () {
- translateElement($(this), lang);
+ translateElement($(this), 'tkey', lang);
+ });
+ $('[data-tkey-placeholder]').each(function () {
+ translateElement($(this), 'tkey-placeholder', lang);
+ });
+ $('[data-tkey-title]').each(function () {
+ translateElement($(this), 'tkey-title', lang);
+ });
+ $('[data-tkey-value]').each(function () {
+ translateElement($(this), 'tkey-value', lang);
});
};
@@ -71,10 +82,10 @@
'translateDom': function (jqTopElt) {
var lang = codeq.settings['gui_lang'];
jqTopElt.filter('[data-tkey]').each(function () {
- translateElement(jqTopElt, lang)
+ translateElement(jqTopElt,'tkey', lang)
});
jqTopElt.find('[data-tkey]').each(function () {
- translateElement($(this), lang);
+ translateElement($(this),'tkey', lang);
});
},