Fixes for gtk-ui translations

This commit is contained in:
Calum Lind 2011-02-14 23:33:52 +00:00
parent 06003b3650
commit c523958bf6
6 changed files with 47 additions and 36 deletions

View File

@ -148,16 +148,16 @@ class ConnectionManager(component.Component):
# Setup host list treeview
self.hostlist.set_model(self.liststore)
render = gtk.CellRendererPixbuf()
column = gtk.TreeViewColumn("Status", render)
column = gtk.TreeViewColumn(_("Status"), render)
column.set_cell_data_func(render, cell_render_status, 3)
self.hostlist.append_column(column)
render = gtk.CellRendererText()
column = gtk.TreeViewColumn("Host", render, text=HOSTLIST_COL_HOST)
column = gtk.TreeViewColumn(_("Host"), render, text=HOSTLIST_COL_HOST)
column.set_cell_data_func(render, cell_render_host, (1, 2, 4))
column.set_expand(True)
self.hostlist.append_column(column)
render = gtk.CellRendererText()
column = gtk.TreeViewColumn("Version", render, text=HOSTLIST_COL_VERSION)
column = gtk.TreeViewColumn(_("Version"), render, text=HOSTLIST_COL_VERSION)
self.hostlist.append_column(column)
# Load any saved host entries
@ -385,7 +385,7 @@ class ConnectionManager(component.Component):
self.glade.get_widget("image_startdaemon").set_from_stock(
gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
self.glade.get_widget("label_startdaemon").set_text(
"_Stop Daemon")
_("_Stop Daemon"))
# Update the start daemon button if the selected host is localhost
if localhost and status == _("Offline"):
@ -393,7 +393,7 @@ class ConnectionManager(component.Component):
self.glade.get_widget("image_startdaemon").set_from_stock(
gtk.STOCK_EXECUTE, gtk.ICON_SIZE_MENU)
self.glade.get_widget("label_startdaemon").set_text(
"_Start Daemon")
_("_Start Daemon"))
if not localhost:
# An offline host

View File

@ -53,13 +53,29 @@ import common
log = logging.getLogger(__name__)
def _(message): return message
TRANSLATE = {
"Do Not Download": _("Do Not Download"),
"Normal Priority": _("Normal Priority"),
"High Priority": _("High Priority"),
"Highest Priority": _("Highest Priority"),
}
del _
def _t(text):
if text in TRANSLATE:
text = TRANSLATE[text]
return _(text)
def cell_priority(column, cell, model, row, data):
if model.get_value(row, 5) == -1:
# This is a folder, so lets just set it blank for now
cell.set_property("text", "")
return
priority = model.get_value(row, data)
cell.set_property("text", deluge.common.FILE_PRIORITY[priority])
cell.set_property("text", _t(deluge.common.FILE_PRIORITY[priority]))
def cell_priority_icon(column, cell, model, row, data):
if model.get_value(row, 5) == -1:
@ -67,13 +83,13 @@ def cell_priority_icon(column, cell, model, row, data):
cell.set_property("stock-id", None)
return
priority = model.get_value(row, data)
if deluge.common.FILE_PRIORITY[priority] == _("Do Not Download"):
if deluge.common.FILE_PRIORITY[priority] == "Do Not Download":
cell.set_property("stock-id", gtk.STOCK_NO)
elif deluge.common.FILE_PRIORITY[priority] == _("Normal Priority"):
elif deluge.common.FILE_PRIORITY[priority] == "Normal Priority":
cell.set_property("stock-id", gtk.STOCK_YES)
elif deluge.common.FILE_PRIORITY[priority] == _("High Priority"):
elif deluge.common.FILE_PRIORITY[priority] == "High Priority":
cell.set_property("stock-id", gtk.STOCK_GO_UP)
elif deluge.common.FILE_PRIORITY[priority] == _("Highest Priority"):
elif deluge.common.FILE_PRIORITY[priority] == "Highest Priority":
cell.set_property("stock-id", gtk.STOCK_GOTO_TOP)
def cell_filename(column, cell, model, row, data):

View File

@ -23,7 +23,7 @@
<widget class="GtkImageMenuItem" id="menuitem_pause">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">_Pause All</property>
<property name="label" translatable="yes">_Pause All</property>
<property name="use_underline">True</property>
<signal name="activate" handler="pause_all"/>
<child internal-child="image">

View File

@ -24,7 +24,7 @@
<widget class="GtkMenu" id="menuitem1_menu1">
<child>
<widget class="GtkImageMenuItem" id="menuitem_addtorrent">
<property name="label">_Add Torrent</property>
<property name="label" translatable="yes">_Add Torrent</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="use_underline">True</property>
@ -41,7 +41,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_createtorrent">
<property name="label">_Create Torrent</property>
<property name="label" translatable="yes">_Create Torrent</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
@ -60,7 +60,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_quitdaemon">
<property name="label">Quit &amp; _Shutdown Daemon</property>
<property name="label" translatable="yes">Quit &amp; _Shutdown Daemon</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
@ -81,7 +81,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_quit">
<property name="label">gtk-quit</property>
<property name="label" translatable="yes">gtk-quit</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
@ -102,7 +102,7 @@
<property name="visible">True</property>
<child>
<widget class="GtkImageMenuItem" id="menuitem_preferences">
<property name="label">gtk-preferences</property>
<property name="label" translatable="yes">gtk-preferences</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
@ -111,7 +111,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_connectionmanager">
<property name="label">_Connection Manager</property>
<property name="label" translatable="yes">_Connection Manager</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_underline">True</property>
@ -236,7 +236,7 @@
<widget class="GtkMenu" id="menuitem2_menu1">
<child>
<widget class="GtkImageMenuItem" id="menuitem_homepage">
<property name="label">_Homepage</property>
<property name="label" translatable="yes">_Homepage</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_underline">True</property>
@ -253,7 +253,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_faq">
<property name="label">_FAQ</property>
<property name="label" translatable="yes">_FAQ</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Frequently Asked Questions</property>
@ -271,7 +271,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_community">
<property name="label">_Community</property>
<property name="label" translatable="yes">_Community</property>
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_underline">True</property>
@ -333,6 +333,7 @@
<widget class="GtkToolButton" id="toolbutton_remove">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Remove torrent</property>
<property name="label" translatable="yes">Remove Torrent</property>
<property name="stock_id">gtk-remove</property>
<signal name="clicked" handler="on_toolbutton_remove_clicked"/>
@ -560,7 +561,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_expand_all">
<property name="label">_Expand All</property>
<property name="label" translatable="yes">_Expand All</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
@ -581,7 +582,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_donotdownload">
<property name="label">_Do Not Download</property>
<property name="label" translatable="yes">_Do Not Download</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
@ -597,7 +598,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_normal">
<property name="label">_Normal Priority</property>
<property name="label" translatable="yes">_Normal Priority</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
@ -613,7 +614,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_high">
<property name="label">_High Priority</property>
<property name="label" translatable="yes">_High Priority</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
@ -629,7 +630,7 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_highest">
<property name="label">Hi_ghest Priority</property>
<property name="label" translatable="yes">Hi_ghest Priority</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
@ -2742,7 +2743,7 @@
<property name="visible">True</property>
<child>
<widget class="GtkImageMenuItem" id="menuitem4">
<property name="label">_Add Peer</property>
<property name="label" translatable="yes">_Add Peer</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Add a peer by its IP</property>
<property name="use_underline">True</property>

View File

@ -123,6 +123,7 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Quit &amp; Shutdown Daemon</property>
<property name="use_underline">True</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_menuitem_quitdaemon_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image8">
@ -143,17 +144,10 @@
<widget class="GtkImageMenuItem" id="menuitem_quit">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">_Quit</property>
<property name="label" translatable="yes">gtk-quit</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menuitem_quit_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
</widget>
</child>
</widget>
</child>
</widget>

View File

@ -71,7 +71,7 @@ class Preferences(component.Component):
self.liststore = gtk.ListStore(int, str)
self.treeview.set_model(self.liststore)
render = gtk.CellRendererText()
column = gtk.TreeViewColumn("Categories", render, text=1)
column = gtk.TreeViewColumn(_("Categories"), render, text=1)
self.treeview.append_column(column)
# Add the default categories
i = 0