Localize the Desktop file

This commit is contained in:
Calum Lind 2011-07-13 21:22:18 +01:00
commit 81d4b00ade
8 changed files with 103 additions and 57 deletions

1
.gitignore vendored
View file

@ -8,3 +8,4 @@ dist
*.tar.* *.tar.*
_trial_temp _trial_temp
deluge/i18n/* deluge/i18n/*
*.desktop

21
check_glade.sh Executable file
View file

@ -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/<property\ name\=\"label\"\ translatable\=\"yes\">$y<\/property>/<property\ name\=\"label\"\ translatable\=\"no\">$y<\/property>/g" $x; \
done;\
done

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import re import re
import sys
# Paths to exclude # Paths to exclude
EXCLUSIONS = [ EXCLUSIONS = [
"deluge/scripts", "deluge/scripts",
@ -13,11 +13,12 @@ POTFILE_IN = "deluge/i18n/POTFILES.in"
pattern = "deluge\/plugins\/.*\/build" pattern = "deluge\/plugins\/.*\/build"
compiled = re.compile(pattern) compiled = re.compile(pattern)
print "Creating " + POTFILE_IN + " ..." sys.stdout.write("Creating " + POTFILE_IN + " ... ")
sys.stdout.flush()
to_translate = [] to_translate = []
for (dirpath, dirnames, filenames) in os.walk("deluge"): for (dirpath, dirnames, filenames) in os.walk("deluge"):
for filename in filenames: 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 dirpath not in EXCLUSIONS \
and not compiled.match(dirpath): and not compiled.match(dirpath):
to_translate.append(os.path.join(dirpath, filename)) to_translate.append(os.path.join(dirpath, filename))

View file

@ -1,9 +1,9 @@
[Desktop Entry] [Desktop Entry]
Version=1.0 Version=1.0
Name=Deluge _Name=Deluge
GenericName=BitTorrent Client _GenericName=BitTorrent Client
X-GNOME-FullName=Deluge BitTorrent Client _X-GNOME-FullName=Deluge BitTorrent Client
Comment=Download and share files over BitTorrent _Comment=Download and share files over BitTorrent
TryExec=deluge-gtk TryExec=deluge-gtk
Exec=deluge-gtk %U Exec=deluge-gtk %U
Icon=deluge Icon=deluge

View file

@ -97,6 +97,7 @@ deluge/core/rpcserver.py
deluge/core/daemon.py deluge/core/daemon.py
deluge/core/core.py deluge/core/core.py
deluge/core/pluginmanager.py deluge/core/pluginmanager.py
deluge/data/share/applications/deluge.desktop.in
deluge/ui/ui.py deluge/ui/ui.py
deluge/ui/common.py deluge/ui/common.py
deluge/ui/coreconfig.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/preferences_dialog.glade
deluge/ui/gtkui/glade/tray_menu.glade deluge/ui/gtkui/glade/tray_menu.glade
deluge/ui/gtkui/glade/torrent_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/edit_trackers.glade
deluge/ui/gtkui/glade/remove_torrent_dialog.glade deluge/ui/gtkui/glade/remove_torrent_dialog.glade
deluge/ui/gtkui/glade/move_storage_dialog.glade deluge/ui/gtkui/glade/move_storage_dialog.glade

View file

@ -1,14 +1,14 @@
# SOME DESCRIPTIVE TITLE. # 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. # This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# #
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: Deluge 1.3.2\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: http://deluge-torrent.org\n"
"POT-Creation-Date: 2011-07-10 16:58+0100\n" "POT-Creation-Date: 2011-07-13 21:23+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -1831,6 +1831,7 @@ msgid "Up:"
msgstr "" msgstr ""
#: deluge/ui/gtkui/systemtray.py:201 deluge/ui/gtkui/systemtray.py:258 #: deluge/ui/gtkui/systemtray.py:201 deluge/ui/gtkui/systemtray.py:258
#: deluge/data/share/applications/deluge.desktop.in.h:2
msgid "Deluge" msgid "Deluge"
msgstr "" msgstr ""
@ -3639,28 +3640,6 @@ msgstr ""
msgid "_Auto Managed" msgid "_Auto Managed"
msgstr "" msgstr ""
#: deluge/ui/gtkui/glade/remove_torrent_dialog2.glade:51
#: deluge/ui/gtkui/glade/remove_torrent_dialog.glade:45
msgid "<big><b>Remove the selected torrent?</b></big>"
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 #: deluge/ui/gtkui/glade/edit_trackers.glade:9
msgid "Edit Trackers" msgid "Edit Trackers"
msgstr "" msgstr ""
@ -3689,6 +3668,14 @@ msgstr ""
msgid "Tracker:" msgid "Tracker:"
msgstr "" msgstr ""
#: deluge/ui/gtkui/glade/remove_torrent_dialog.glade:45
msgid "<big><b>Remove the selected torrent?</b></big>"
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 #: deluge/ui/gtkui/glade/remove_torrent_dialog.glade:117
msgid "Remove With _Data" msgid "Remove With _Data"
msgstr "" msgstr ""
@ -3708,3 +3695,15 @@ msgstr ""
#: deluge/ui/gtkui/glade/move_storage_dialog.glade:78 #: deluge/ui/gtkui/glade/move_storage_dialog.glade:78
msgid "Destination:" msgid "Destination:"
msgstr "" 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 ""

View file

@ -1,20 +1,26 @@
#!/bin/sh #!/bin/sh
for x in `find . -name '*.glade' |grep -v '.git\|build'` ; do \ PACKAGE="Deluge"
for y in gtk-add gtk-apply gtk-bold gtk-cancel gtk-cdrom gtk-clear \ PKG_VERSION=`grep "version\ =\ \"" setup.py | cut -d '"' -f2`
gtk-close gtk-color-picker gtk-connect gtk-convert gtk-copy gtk-cut \ PO_DIR="deluge/i18n"
gtk-delete gtk-dialog-error gtk-dialog-info gtk-dialog-question \ POTFILES_IN="infiles.list"
gtk-dialog-warning gtk-dnd gtk-dnd-multiple gtk-edit gtk-execute gtk-find \ POT_FILE=deluge.pot
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 \ cp $PO_DIR/POTFILES.in $POTFILES_IN
gtk-go-up gtk-help gtk-home gtk-index gtk-italic gtk-jump-to \ DESKTOP_FILE=`grep ".*desktop.in$" $POTFILES_IN`
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 \ if [ $DESKTOP_FILE ]; then
gtk-print-preview gtk-properties gtk-quit gtk-redo gtk-refresh \ sed -i "\:$DESKTOP_FILE:d" $POTFILES_IN
gtk-remove gtk-revert-to-saved gtk-save gtk-save-as gtk-select-color \ intltool-extract --quiet --type=gettext/ini $DESKTOP_FILE
gtk-select-font gtk-sort-descending gtk-spell-check gtk-stop \ echo "$DESKTOP_FILE.h" >> $POTFILES_IN
gtk-strikethrough gtk-undelete gtk-underline gtk-undo gtk-yes \ fi
gtk-zoom-100 gtk-zoom-fit gtk-zoom-in gtk-zoom-out; do \
sed -i "s/<property\ name\=\"label\"\ translatable\=\"yes\">$y<\/property>/<property\ name\=\"label\"\ translatable\=\"no\">$y<\/property>/g" $x; \ xgettext --from-code=UTF-8 -kN_:1 -f $POTFILES_IN -o $PO_DIR/$POT_FILE --package-name=$PACKAGE \
done;\ --copyright-holder='Deluge Team' --package-version=$PKG_VERSION \
done --msgid-bugs-address=http://deluge-torrent.org
xgettext --from-code ISO-8859-1 -f deluge/i18n/POTFILES.in -o deluge/i18n/deluge.pot
# 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"

View file

@ -253,8 +253,20 @@ class build_trans(cmd.Command):
def run(self): def run(self):
po_dir = os.path.join(os.path.dirname(__file__), 'deluge/i18n/') 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 path, names, filenames in os.walk(po_dir):
for f in filenames: for f in filenames:
uptoDate = False
if f.endswith('.po'): if f.endswith('.po'):
lang = f[:len(f) - 3] lang = f[:len(f) - 3]
src = os.path.join(path, f) src = os.path.join(path, f)
@ -264,14 +276,22 @@ class build_trans(cmd.Command):
if not os.path.exists(dest_path): if not os.path.exists(dest_path):
os.makedirs(dest_path) os.makedirs(dest_path)
if not os.path.exists(dest): if not os.path.exists(dest):
print('Compiling %s' % src) sys.stdout.write('%s, ' % lang)
sys.stdout.flush()
msgfmt.make(src, dest) msgfmt.make(src, dest)
else: else:
src_mtime = os.stat(src)[8] src_mtime = os.stat(src)[8]
dest_mtime = os.stat(dest)[8] dest_mtime = os.stat(dest)[8]
if src_mtime > dest_mtime: if src_mtime > dest_mtime:
print('Compiling %s' % src) sys.stdout.write('%s, ' % lang)
sys.stdout.flush()
msgfmt.make(src, dest) 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): class build_plugins(cmd.Command):
description = "Build plugins into .eggs" description = "Build plugins into .eggs"
@ -507,7 +527,6 @@ setup(
libtorrent in it's backend to handle the bittorrent protocol.""", libtorrent in it's backend to handle the bittorrent protocol.""",
url = "http://deluge-torrent.org", url = "http://deluge-torrent.org",
license = "GPLv3", license = "GPLv3",
cmdclass = cmdclass, cmdclass = cmdclass,
data_files = _data_files, data_files = _data_files,
ext_package = "deluge", ext_package = "deluge",
@ -519,7 +538,6 @@ setup(
"data/pixmaps/*.gif", "data/pixmaps/*.gif",
"data/pixmaps/flags/*.png", "data/pixmaps/flags/*.png",
"plugins/*.egg", "plugins/*.egg",
"i18n/*.pot",
"i18n/*/LC_MESSAGES/*.mo", "i18n/*/LC_MESSAGES/*.mo",
"ui/web/gettext.js", "ui/web/gettext.js",
"ui/web/index.html", "ui/web/index.html",