Changeset 8a0b7d


Ignore:
Timestamp:
03/22/2017 12:55:17 PM (8 years ago)
Author:
Calum Lind <calumlind+deluge@gmail.com>
Branches:
2.0.x, develop, master
Children:
d485eb
Parents:
a76fde
git-author:
Calum Lind <calumlind+deluge@gmail.com> (03/22/2017 12:45:46 PM)
git-committer:
Calum Lind <calumlind+deluge@gmail.com> (03/22/2017 12:55:17 PM)
Message:

#2837 [WebUI] Create gettext.js when building

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gen_web_gettext.py

    ra76fde r8a0b7d  
    1818WEBUI_JS_DIR = 'deluge/ui/web/js/deluge-all'
    1919# Enabling Debug adds file and line number as comments to the gettext file.
    20 DEBUG = False
     20DEBUG = True
    2121
    2222
     
    7272    'get:function(string){if (this.maps[string]){string=this.maps[string]} return string}};'
    7373    'function _(string){return GetText.get(string)}')
     74GETTEXT_SUBST_TPL = ("GetText.add('{key}','${{escape(_(\"{key}\"))}}')\n")
    7475
    7576
     
    9596            if DEBUG:
    9697                fp.write('\n//: %s' % '//: '.join(['%s:%s\n' % x for x in strings[key]]))
    97             fp.write('''GetText.add('%(key)s','${escape(_("%(key)s"))}')\n''' % locals())
     98            fp.write(GETTEXT_SUBST_TPL.format(key=key))
    9899    return gettext_file
    99100
  • setup.py

    ra76fde r8a0b7d  
    134134                    print('Import error: %s' % import_error)
    135135                    sys.exit(1)
     136
     137        # Create the gettext.js file for translations.
     138        from gen_web_gettext import create_gettext_js
     139        deluge_all_path = os.path.join(js_basedir, self.JS_SRC_DIRS[0])
     140        print('Creating WebUI translation file: %s/gettext.js' % deluge_all_path)
     141        create_gettext_js(deluge_all_path)
    136142
    137143
Note: See TracChangeset for help on using the changeset viewer.