diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-03-30 13:04:35 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-03-30 13:09:29 +0200 |
commit | 07a6662be9f1a59bfe3ae42baa6589d74568c9ce (patch) | |
tree | 80b2def41adcd06e360e475d712d37196cd5f45f /js/codeq/translation.js | |
parent | 5b03ea193c1927305fc99b93307b6c74bde0d84d (diff) |
Add codeq.tr.translate function for GUI strings not in DOM
Diffstat (limited to 'js/codeq/translation.js')
-rw-r--r-- | js/codeq/translation.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/js/codeq/translation.js b/js/codeq/translation.js index b453876..e648ae3 100644 --- a/js/codeq/translation.js +++ b/js/codeq/translation.js @@ -98,6 +98,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ 'emptyDictionary': {}, // use this with registerDictionary when you don't want any translations + 'translate': function (key, lang) { + var dict = dicts['gui']; + lang = lang || codeq.settings['gui_lang']; + if (dict && dict[key] && dict[key][lang]) { + return dict[key][lang]; + } + }, + 'translateDom': function (jqTopElt) { var lang = codeq.settings['gui_lang']; jqTopElt.filter('[data-tkey]').each(function () { @@ -106,10 +114,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ jqTopElt.find('[data-tkey]').each(function () { translateElement($(this),'tkey', lang); }); - }, - - 'getDictionary': function (name) { - return dicts[name]; } }; })(); |