Skip to content

Commit

Permalink
[WebUI] Fix to gen_web_gettext
Browse files Browse the repository at this point in the history
  • Loading branch information
bendikro authored and cas-- committed Apr 25, 2016
1 parent b76d208 commit 74f2f45
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gen_web_gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def create_gettext_js(js_dir):
gettext_tpl = '''GetText={maps:{},\
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)}\
'''
function _(string) {return GetText.get(string)}
'''

gettext_file = os.path.join(os.path.dirname(js_dir), 'gettext.js')
with open(gettext_file, 'w') as fp:
Expand All @@ -47,7 +47,8 @@ def create_gettext_js(js_dir):
if DEBUG:
fp.write('\n// %s\n' % ', '.join(['%s:%s' % x for x in strings[key]]))
fp.write('''GetText.add('%(key)s','${escape(_("%(key)s"))}')\n''' % locals())
return gettext_file

if __name__ == '__main__':
create_gettext_js(WEBUI_JS_DIR)
print('Created gettext.js for %s' % WEBUI_JS_DIR)
filename = create_gettext_js(WEBUI_JS_DIR)
print("Created '%s'" % filename)

0 comments on commit 74f2f45

Please sign in to comment.