diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/codeq/translation.js | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/js/codeq/translation.js b/js/codeq/translation.js index e648ae3..320cbc1 100644 --- a/js/codeq/translation.js +++ b/js/codeq/translation.js @@ -61,20 +61,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ else jqElt.html(html); }, translateDocument = function (lang) { - $('[data-tkey]').each(function () { - 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); - }); - $('[data-tkey-data-content]').each(function () { - translateElement($(this), 'tkey-data-content', lang); + var keys = ['', 'placeholder', 'title', 'value', 'data-content']; + keys.forEach(function (key) { + var tkey = (key == '' ? 'tkey' : 'tkey-' + key), + selector = '[data-' + tkey + ']'; + $(selector).each(function () { + translateElement($(this), tkey, lang); + }); }); }; |