diff --git a/.gitignore b/.gitignore index 575a48236..2e38c0115 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ dist *.tar.* _trial_temp deluge/i18n/* +*.desktop diff --git a/check_glade.sh b/check_glade.sh new file mode 100755 index 000000000..f3d081c5b --- /dev/null +++ b/check_glade.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Fixes glade files which may have set gtk stock labels set to translatable +for x in `find . -name '*.glade' |grep -v '.git\|build'` ; do \ + for y in gtk-add gtk-apply gtk-bold gtk-cancel gtk-cdrom gtk-clear \ + gtk-close gtk-color-picker gtk-connect gtk-convert gtk-copy gtk-cut \ + gtk-delete gtk-dialog-error gtk-dialog-info gtk-dialog-question \ + gtk-dialog-warning gtk-dnd gtk-dnd-multiple gtk-edit gtk-execute gtk-find \ + gtk-find-and-replace gtk-floppy gtk-goto-bottom gtk-goto-first \ + gtk-goto-last gtk-goto-top gtk-go-back gtk-go-down gtk-go-forward \ + gtk-go-up gtk-help gtk-home gtk-index gtk-italic gtk-jump-to \ + gtk-justify-center gtk-justify-fill gtk-justify-left gtk-missing-image \ + gtk-new gtk-no gtk-ok gtk-open gtk-paste gtk-preferences gtk-print \ + gtk-print-preview gtk-properties gtk-quit gtk-redo gtk-refresh \ + gtk-remove gtk-revert-to-saved gtk-save gtk-save-as gtk-select-color \ + gtk-select-font gtk-sort-descending gtk-spell-check gtk-stop \ + gtk-strikethrough gtk-undelete gtk-underline gtk-undo gtk-yes \ + gtk-zoom-100 gtk-zoom-fit gtk-zoom-in gtk-zoom-out; do \ + sed -i "s/$y<\/property>/$y<\/property>/g" $x; \ + done;\ + done diff --git a/create_potfiles_in.py b/create_potfiles_in.py index d6d21bd4f..586192c5f 100755 --- a/create_potfiles_in.py +++ b/create_potfiles_in.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import os import re - +import sys # Paths to exclude EXCLUSIONS = [ "deluge/scripts", @@ -13,11 +13,12 @@ POTFILE_IN = "deluge/i18n/POTFILES.in" pattern = "deluge\/plugins\/.*\/build" compiled = re.compile(pattern) -print "Creating " + POTFILE_IN + " ..." +sys.stdout.write("Creating " + POTFILE_IN + " ... ") +sys.stdout.flush() to_translate = [] for (dirpath, dirnames, filenames) in os.walk("deluge"): for filename in filenames: - if os.path.splitext(filename)[1] in (".py", ".glade") \ + if os.path.splitext(filename)[1] in (".py", ".glade", ".in") \ and dirpath not in EXCLUSIONS \ and not compiled.match(dirpath): to_translate.append(os.path.join(dirpath, filename)) diff --git a/deluge/data/share/applications/deluge.desktop b/deluge/data/share/applications/deluge.desktop.in similarity index 62% rename from deluge/data/share/applications/deluge.desktop rename to deluge/data/share/applications/deluge.desktop.in index b482a311f..43b40f7b1 100644 --- a/deluge/data/share/applications/deluge.desktop +++ b/deluge/data/share/applications/deluge.desktop.in @@ -1,9 +1,9 @@ [Desktop Entry] Version=1.0 -Name=Deluge -GenericName=BitTorrent Client -X-GNOME-FullName=Deluge BitTorrent Client -Comment=Download and share files over BitTorrent +_Name=Deluge +_GenericName=BitTorrent Client +_X-GNOME-FullName=Deluge BitTorrent Client +_Comment=Download and share files over BitTorrent TryExec=deluge-gtk Exec=deluge-gtk %U Icon=deluge diff --git a/deluge/i18n/POTFILES.in b/deluge/i18n/POTFILES.in index cfc4f883f..c7b7bb3f6 100644 --- a/deluge/i18n/POTFILES.in +++ b/deluge/i18n/POTFILES.in @@ -97,6 +97,7 @@ deluge/core/rpcserver.py deluge/core/daemon.py deluge/core/core.py deluge/core/pluginmanager.py +deluge/data/share/applications/deluge.desktop.in deluge/ui/ui.py deluge/ui/common.py deluge/ui/coreconfig.py @@ -155,7 +156,6 @@ deluge/ui/gtkui/glade/connection_manager.glade deluge/ui/gtkui/glade/preferences_dialog.glade deluge/ui/gtkui/glade/tray_menu.glade deluge/ui/gtkui/glade/torrent_menu.glade -deluge/ui/gtkui/glade/remove_torrent_dialog2.glade deluge/ui/gtkui/glade/edit_trackers.glade deluge/ui/gtkui/glade/remove_torrent_dialog.glade deluge/ui/gtkui/glade/move_storage_dialog.glade diff --git a/deluge/i18n/deluge.pot b/deluge/i18n/deluge.pot index 11d3251b6..2b8bd0c83 100644 --- a/deluge/i18n/deluge.pot +++ b/deluge/i18n/deluge.pot @@ -1,14 +1,14 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# Copyright (C) 2011 Deluge Team # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-10 16:58+0100\n" +"Project-Id-Version: Deluge 1.3.2\n" +"Report-Msgid-Bugs-To: http://deluge-torrent.org\n" +"POT-Creation-Date: 2011-07-13 21:23+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1831,6 +1831,7 @@ msgid "Up:" msgstr "" #: deluge/ui/gtkui/systemtray.py:201 deluge/ui/gtkui/systemtray.py:258 +#: deluge/data/share/applications/deluge.desktop.in.h:2 msgid "Deluge" msgstr "" @@ -3639,28 +3640,6 @@ msgstr "" msgid "_Auto Managed" msgstr "" -#: deluge/ui/gtkui/glade/remove_torrent_dialog2.glade:51 -#: deluge/ui/gtkui/glade/remove_torrent_dialog.glade:45 -msgid "Remove the selected torrent?" -msgstr "" - -#: deluge/ui/gtkui/glade/remove_torrent_dialog2.glade:66 -#: deluge/ui/gtkui/glade/remove_torrent_dialog.glade:57 -msgid "If you remove the data, it will be lost permanently." -msgstr "" - -#: deluge/ui/gtkui/glade/remove_torrent_dialog2.glade:127 -msgid "action" -msgstr "" - -#: deluge/ui/gtkui/glade/remove_torrent_dialog2.glade:129 -msgid "Remove Files" -msgstr "" - -#: deluge/ui/gtkui/glade/remove_torrent_dialog2.glade:198 -msgid "Keep Files" -msgstr "" - #: deluge/ui/gtkui/glade/edit_trackers.glade:9 msgid "Edit Trackers" msgstr "" @@ -3689,6 +3668,14 @@ msgstr "" msgid "Tracker:" msgstr "" +#: deluge/ui/gtkui/glade/remove_torrent_dialog.glade:45 +msgid "Remove the selected torrent?" +msgstr "" + +#: deluge/ui/gtkui/glade/remove_torrent_dialog.glade:57 +msgid "If you remove the data, it will be lost permanently." +msgstr "" + #: deluge/ui/gtkui/glade/remove_torrent_dialog.glade:117 msgid "Remove With _Data" msgstr "" @@ -3708,3 +3695,15 @@ msgstr "" #: deluge/ui/gtkui/glade/move_storage_dialog.glade:78 msgid "Destination:" msgstr "" + +#: deluge/data/share/applications/deluge.desktop.in.h:1 +msgid "BitTorrent Client" +msgstr "" + +#: deluge/data/share/applications/deluge.desktop.in.h:3 +msgid "Deluge BitTorrent Client" +msgstr "" + +#: deluge/data/share/applications/deluge.desktop.in.h:4 +msgid "Download and share files over BitTorrent" +msgstr "" diff --git a/gettextize.sh b/gettextize.sh index cc2d5ab00..9440af5a9 100755 --- a/gettextize.sh +++ b/gettextize.sh @@ -1,20 +1,26 @@ #!/bin/sh -for x in `find . -name '*.glade' |grep -v '.git\|build'` ; do \ - for y in gtk-add gtk-apply gtk-bold gtk-cancel gtk-cdrom gtk-clear \ - gtk-close gtk-color-picker gtk-connect gtk-convert gtk-copy gtk-cut \ - gtk-delete gtk-dialog-error gtk-dialog-info gtk-dialog-question \ - gtk-dialog-warning gtk-dnd gtk-dnd-multiple gtk-edit gtk-execute gtk-find \ - gtk-find-and-replace gtk-floppy gtk-goto-bottom gtk-goto-first \ - gtk-goto-last gtk-goto-top gtk-go-back gtk-go-down gtk-go-forward \ - gtk-go-up gtk-help gtk-home gtk-index gtk-italic gtk-jump-to \ - gtk-justify-center gtk-justify-fill gtk-justify-left gtk-missing-image \ - gtk-new gtk-no gtk-ok gtk-open gtk-paste gtk-preferences gtk-print \ - gtk-print-preview gtk-properties gtk-quit gtk-redo gtk-refresh \ - gtk-remove gtk-revert-to-saved gtk-save gtk-save-as gtk-select-color \ - gtk-select-font gtk-sort-descending gtk-spell-check gtk-stop \ - gtk-strikethrough gtk-undelete gtk-underline gtk-undo gtk-yes \ - gtk-zoom-100 gtk-zoom-fit gtk-zoom-in gtk-zoom-out; do \ - sed -i "s/$y<\/property>/$y<\/property>/g" $x; \ - done;\ - done -xgettext --from-code ISO-8859-1 -f deluge/i18n/POTFILES.in -o deluge/i18n/deluge.pot +PACKAGE="Deluge" +PKG_VERSION=`grep "version\ =\ \"" setup.py | cut -d '"' -f2` +PO_DIR="deluge/i18n" +POTFILES_IN="infiles.list" +POT_FILE=deluge.pot + +cp $PO_DIR/POTFILES.in $POTFILES_IN +DESKTOP_FILE=`grep ".*desktop.in$" $POTFILES_IN` + +if [ $DESKTOP_FILE ]; then + sed -i "\:$DESKTOP_FILE:d" $POTFILES_IN + intltool-extract --quiet --type=gettext/ini $DESKTOP_FILE + echo "$DESKTOP_FILE.h" >> $POTFILES_IN +fi + +xgettext --from-code=UTF-8 -kN_:1 -f $POTFILES_IN -o $PO_DIR/$POT_FILE --package-name=$PACKAGE \ + --copyright-holder='Deluge Team' --package-version=$PKG_VERSION \ + --msgid-bugs-address=http://deluge-torrent.org + +# sub the YEAR in the copyright message +sed -i -e '2s/YEAR/'`date +%Y`'/' "$PO_DIR/$POT_FILE" + +rm -f $POTFILES_IN +rm -f "$DESKTOP_FILE.h" +echo "Created $PO_DIR/$POT_FILE" diff --git a/setup.py b/setup.py index 848ac02ea..c02ae27b7 100644 --- a/setup.py +++ b/setup.py @@ -253,8 +253,20 @@ class build_trans(cmd.Command): def run(self): po_dir = os.path.join(os.path.dirname(__file__), 'deluge/i18n/') + + # creates the translated desktop file + INTLTOOL_MERGE='intltool-merge' + INTLTOOL_MERGE_OPTS='--utf8 --quiet --desktop-style' + desktop_in='deluge/data/share/applications/deluge.desktop.in' + desktop_data='deluge/data/share/applications/deluge.desktop' + 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)) + + print('Compiling po files from %s...' % po_dir), for path, names, filenames in os.walk(po_dir): for f in filenames: + uptoDate = False if f.endswith('.po'): lang = f[:len(f) - 3] src = os.path.join(path, f) @@ -264,14 +276,22 @@ class build_trans(cmd.Command): if not os.path.exists(dest_path): os.makedirs(dest_path) if not os.path.exists(dest): - print('Compiling %s' % src) + sys.stdout.write('%s, ' % lang) + sys.stdout.flush() msgfmt.make(src, dest) else: src_mtime = os.stat(src)[8] dest_mtime = os.stat(dest)[8] if src_mtime > dest_mtime: - print('Compiling %s' % src) + sys.stdout.write('%s, ' % lang) + sys.stdout.flush() msgfmt.make(src, dest) + else: + uptoDate = True + + if uptoDate: + sys.stdout.write(' po files already upto date. ') + sys.stdout.write('\b\b \nFinished compiling translation files. \n') class build_plugins(cmd.Command): description = "Build plugins into .eggs" @@ -507,7 +527,6 @@ setup( libtorrent in it's backend to handle the bittorrent protocol.""", url = "http://deluge-torrent.org", license = "GPLv3", - cmdclass = cmdclass, data_files = _data_files, ext_package = "deluge", @@ -519,7 +538,6 @@ setup( "data/pixmaps/*.gif", "data/pixmaps/flags/*.png", "plugins/*.egg", - "i18n/*.pot", "i18n/*/LC_MESSAGES/*.mo", "ui/web/gettext.js", "ui/web/index.html",