diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2017-03-22 12:45:46 +0000 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2017-03-22 12:55:17 +0000 |
commit | 8a0b7d970a8ee0c1588503e1d74879e8826887a8 (patch) | |
tree | f2da1fa57273f56091ea99c7c1ae2edf1c680dec /gen_web_gettext.py | |
parent | a76fde5febbefc664702fb870156a29a9633cda9 (diff) | |
download | deluge-8a0b7d970a8ee0c1588503e1d74879e8826887a8.tar.gz deluge-8a0b7d970a8ee0c1588503e1d74879e8826887a8.tar.bz2 deluge-8a0b7d970a8ee0c1588503e1d74879e8826887a8.zip |
[#2837] [WebUI] Create gettext.js when building
Diffstat (limited to 'gen_web_gettext.py')
-rwxr-xr-x | gen_web_gettext.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gen_web_gettext.py b/gen_web_gettext.py index a4f18049c..c37000481 100755 --- a/gen_web_gettext.py +++ b/gen_web_gettext.py @@ -17,7 +17,7 @@ import re WEBUI_JS_DIR = 'deluge/ui/web/js/deluge-all' # Enabling Debug adds file and line number as comments to the gettext file. -DEBUG = False +DEBUG = True def check_missing_markup(js_dir): @@ -71,6 +71,7 @@ GETTEXT_TPL = ( 'add:function(string,translation){this.maps[string]=translation},' 'get:function(string){if (this.maps[string]){string=this.maps[string]} return string}};' 'function _(string){return GetText.get(string)}') +GETTEXT_SUBST_TPL = ("GetText.add('{key}','${{escape(_(\"{key}\"))}}')\n") def create_gettext_js(js_dir): @@ -94,7 +95,7 @@ def create_gettext_js(js_dir): for key in sorted(strings): if DEBUG: fp.write('\n//: %s' % '//: '.join(['%s:%s\n' % x for x in strings[key]])) - fp.write('''GetText.add('%(key)s','${escape(_("%(key)s"))}')\n''' % locals()) + fp.write(GETTEXT_SUBST_TPL.format(key=key)) return gettext_file |