Added a translation function for 'See %s details'

svn: r17583
This commit is contained in:
Doug Blank 2011-05-27 12:07:15 +00:00
parent 188acd427b
commit 9a46bb5792
3 changed files with 31 additions and 2 deletions

View File

@ -50,6 +50,7 @@ import DateHandler
import GrampsDisplay import GrampsDisplay
import ManagedWindow import ManagedWindow
from gen.ggettext import sgettext as _ from gen.ggettext import sgettext as _
from TransUtils import trans_see_details
from constfunc import mac from constfunc import mac
from glade import Glade from glade import Glade
from DdTargets import DdTargets from DdTargets import DdTargets
@ -1325,7 +1326,7 @@ class MultiTreeView(gtk.TreeView):
objclass, handle = None, None objclass, handle = None, None
if objclass in ['Person', 'Event', 'Media', 'Source', if objclass in ['Person', 'Event', 'Media', 'Source',
'Repository', 'Family', 'Note', 'Place']: 'Repository', 'Family', 'Note', 'Place']:
menu_item = gtk.MenuItem(_("See %s details") % objclass) menu_item = gtk.MenuItem(trans_see_details(objclass))
menu_item.connect("activate", menu_item.connect("activate",
lambda widget: self.edit_obj(objclass, handle)) lambda widget: self.edit_obj(objclass, handle))
popup.append(menu_item) popup.append(menu_item)

View File

@ -26,6 +26,7 @@ Provide a simplified table creation interface
import cgi import cgi
import copy import copy
from gen.ggettext import gettext as _ from gen.ggettext import gettext as _
from TransUtils import trans_see_details
import cPickle as pickle import cPickle as pickle
import gen.lib import gen.lib
@ -129,7 +130,7 @@ class SimpleTable(object):
if (index is not None and self.__link[index]): if (index is not None and self.__link[index]):
# See details (edit, etc): # See details (edit, etc):
objclass, handle = self.__link[index] 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", menu_item.connect("activate",
lambda widget: self.on_table_doubleclick(treeview)) lambda widget: self.on_table_doubleclick(treeview))
popup.append(menu_item) popup.append(menu_item)

View File

@ -288,3 +288,30 @@ def get_available_translations():
languages.sort() languages.sort()
return languages 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")