summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMarko Pušnik <marko.pusnik@guru.si>2015-10-13 15:34:51 +0200
committerMarko Pušnik <marko.pusnik@guru.si>2015-10-13 15:34:51 +0200
commit8855c93594c4eca1d0c5d3e2f9f2b35cc7d420a1 (patch)
tree2d88cdcc29e5867549cc232433adde0a63bf761c /js
parentd82ad6356586e74f41869647d57157993a3d6161 (diff)
login, sinup and change password modals translations
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 d127fe3..b8323e1 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 dda5aec..bd2bf32 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.getLang();
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);
});
},