* various: Use TransUtils.sgettext instead of gettext.gettext to work out stripping the context.

svn: r6155
This commit is contained in:
Alex Roitman
2006-03-16 20:24:27 +00:00
parent 691dc6e757
commit 93add4967a
160 changed files with 183 additions and 184 deletions

View File

@@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2005 Donald N. Allingham
# Copyright (C) 2000-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,9 +18,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
from gettext import gettext as _
# $Id$
def strip_context(msgid,sep='|'):
from gettext import gettext
def sgettext(msgid,sep='|'):
"""
Strip the context used for resolving translation ambiguities.
@@ -37,8 +39,8 @@ def strip_context(msgid,sep='|'):
@rtype: unicode
"""
msgval = _(msgid)
sep_idx = msgid.rfind(sep)
if msgval == msgid and sep_idx != -1:
msgval = gettext(msgid)
if msgval == msgid:
sep_idx = msgid.rfind(sep)
msgval = msgid[sep_idx+1:]
return msgval