From 9a46bb579247026bbd4d280244d22d0478dbc5be Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Fri, 27 May 2011 12:07:15 +0000 Subject: [PATCH] Added a translation function for 'See %s details' svn: r17583 --- src/ScratchPad.py | 3 ++- src/Simple/_SimpleTable.py | 3 ++- src/TransUtils.py | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/ScratchPad.py b/src/ScratchPad.py index eede08b9b..662a7ec23 100644 --- a/src/ScratchPad.py +++ b/src/ScratchPad.py @@ -50,6 +50,7 @@ import DateHandler import GrampsDisplay import ManagedWindow from gen.ggettext import sgettext as _ +from TransUtils import trans_see_details from constfunc import mac from glade import Glade from DdTargets import DdTargets @@ -1325,7 +1326,7 @@ class MultiTreeView(gtk.TreeView): objclass, handle = None, None if objclass in ['Person', 'Event', 'Media', 'Source', 'Repository', 'Family', 'Note', 'Place']: - menu_item = gtk.MenuItem(_("See %s details") % objclass) + menu_item = gtk.MenuItem(trans_see_details(objclass)) menu_item.connect("activate", lambda widget: self.edit_obj(objclass, handle)) popup.append(menu_item) diff --git a/src/Simple/_SimpleTable.py b/src/Simple/_SimpleTable.py index 594fff0fb..0294f5946 100644 --- a/src/Simple/_SimpleTable.py +++ b/src/Simple/_SimpleTable.py @@ -26,6 +26,7 @@ Provide a simplified table creation interface import cgi import copy from gen.ggettext import gettext as _ +from TransUtils import trans_see_details import cPickle as pickle import gen.lib @@ -129,7 +130,7 @@ class SimpleTable(object): if (index is not None and self.__link[index]): # See details (edit, etc): objclass, handle = self.__link[index] - menu_item = gtk.MenuItem(_("See %s details") % objclass) + menu_item = gtk.MenuItem(trans_see_details(objclass)) menu_item.connect("activate", lambda widget: self.on_table_doubleclick(treeview)) popup.append(menu_item) diff --git a/src/TransUtils.py b/src/TransUtils.py index 4eb7f3ca8..f537eefa0 100644 --- a/src/TransUtils.py +++ b/src/TransUtils.py @@ -288,3 +288,30 @@ def get_available_translations(): languages.sort() return languages + +def trans_see_details(objclass_str): + """ + Translates objclass_str into "See %s details", where objclass_str + is 'Person', 'person', 'Family', 'family', etc. + """ + objclass = objclass_str.lower() + if objclass == "person": + return _("See person details") + elif objclass == "family": + return _("See family details") + elif objclass == "place": + return _("See place details") + elif objclass == "event": + return _("See event details") + elif objclass == "repository": + return _("See repository details") + elif objclass == "note": + return _("See note details") + elif objclass in ["media", "mediaobject"]: + return _("See media details") + elif objclass == "source": + return _("See source details") + elif objclass == "filter": + return _("See filter details") + else: + return _("See details")