diff --git a/.gitignore b/.gitignore index 1922bb929..f885f437f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ _trial_temp deluge/i18n/*/ deluge.pot *.desktop +*.appdata.xml .build_data* osx/app RELEASE-VERSION diff --git a/deluge/ui/data/share/appdata/deluge.appdata.xml.in b/deluge/ui/data/share/appdata/deluge.appdata.xml.in index 001dd7547..88d42a82a 100644 --- a/deluge/ui/data/share/appdata/deluge.appdata.xml.in +++ b/deluge/ui/data/share/appdata/deluge.appdata.xml.in @@ -4,9 +4,9 @@ CC0-1.0 GPL-2.0+ deluge - Deluge BitTorrent Client - Deluge Team - Deluge is a lightweight, Free Software, cross-platform BitTorrent client. + <_name>Deluge BitTorrent Client + <_developer_name>Deluge Team + <_summary>Deluge is a lightweight, Free Software, cross-platform BitTorrent client. http://www.deluge-torrent.org/ http://dev.deluge-torrent.org diff --git a/gen_web_gettext.py b/gen_web_gettext.py index 9d1b066f4..fb97228c9 100755 --- a/gen_web_gettext.py +++ b/gen_web_gettext.py @@ -80,11 +80,11 @@ def create_gettext_js(js_dir): locations.append((os.path.basename(filename), lineno + 1)) strings[string] = locations - 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)} -''' + 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)}') gettext_file = os.path.join(os.path.dirname(js_dir), 'gettext.js') with open(gettext_file, 'w') as fp: diff --git a/generate_pot.py b/generate_pot.py index 6f510ac7e..470b8f40c 100755 --- a/generate_pot.py +++ b/generate_pot.py @@ -53,12 +53,18 @@ for (dirpath, dirnames, filenames) in os.walk('deluge'): filepath = os.path.join(dirpath, filename) if os.path.splitext(filepath)[1] in ('.py', '.glade'): to_translate.append(filepath) - elif filename.endswith('.in'): - call(['intltool-extract', '--quiet', '--type=gettext/ini', filepath]) - to_translate.append(filepath + '.h') - elif filename.endswith('.ui'): - call(['intltool-extract', '--quiet', '--type=gettext/glade', filepath]) - to_translate.append(filepath + '.h') + else: + if filename.endswith('.xml.in'): + gtxt_type = 'gettext/xml' + elif filename.endswith('.in'): + gtxt_type = 'gettext/ini' + elif filename.endswith('.ui'): + gtxt_type = 'gettext/glade' + else: + continue + call(['intltool-extract', '--quiet', '--type=%s' % gtxt_type, filepath]) + filepath += '.h' + to_translate.append(filepath) with open(INFILES_LIST, 'w') as f: for line in to_translate: diff --git a/setup.py b/setup.py index e3b32992c..bdc789964 100755 --- a/setup.py +++ b/setup.py @@ -182,20 +182,19 @@ class BuildTranslations(cmd.Command): basedir = os.path.join(self.build_lib, 'deluge', 'i18n') if not windows_check(): - # creates the translated desktop file intltool_merge = 'intltool-merge' - intltool_merge_opts = '--utf8 --quiet --desktop-style' - desktop_in = 'deluge/ui/data/share/applications/deluge.desktop.in' - print('Creating desktop file: %s' % desktop_data) - os.system('C_ALL=C ' + '%s ' * 5 % (intltool_merge, intltool_merge_opts, - po_dir, desktop_in, desktop_data)) + intltool_merge_opts = '--utf8 --quiet' + for data_file in (desktop_data, appdata_data): + # creates the translated file from .in file. + in_file = data_file + '.in' + if 'xml' in data_file: + intltool_merge_opts += ' --xml-style' + elif 'desktop' in data_file: + intltool_merge_opts += ' --desktop-style' - # creates the translated appdata.xml file - intltool_merge_opts = '--utf8 --quiet --xml-style' - appdata_in = 'deluge/ui/data/share/appdata/deluge.appdata.xml.in' - print('Creating appdata.xml file: %s' % appdata_data) - os.system('C_ALL=C ' + '%s ' * 5 % (intltool_merge, intltool_merge_opts, - po_dir, appdata_in, appdata_data)) + print('Creating file: %s' % data_file) + os.system('C_ALL=C ' + '%s ' * 5 % ( + intltool_merge, intltool_merge_opts, po_dir, in_file, data_file)) print('Compiling po files from %s...' % po_dir) for path, names, filenames in os.walk(po_dir): @@ -239,12 +238,10 @@ class CleanTranslations(cmd.Command): self.set_undefined_options('clean', ('all', 'all')) def run(self): - if os.path.isfile(desktop_data): - print('Deleting %s' % desktop_data) - os.remove(desktop_data) - if os.path.isfile(appdata_data): - print('Deleting %s' % appdata_data) - os.remove(appdata_data) + for path in (desktop_data, appdata_data): + if os.path.isfile(path): + print('Deleting %s' % path) + os.remove(path) class BuildPlugins(cmd.Command):