Use named_arguments for translators (patch by MathieuMD)

svn: r19358
This commit is contained in:
Jérôme Rapinat 2012-04-19 13:44:56 +00:00
parent f7178ecca7
commit 0145b5ea22
7 changed files with 28 additions and 15 deletions

View File

@ -492,9 +492,12 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
folder = os.path.split(filename)[0]
confirm_text = _(
'The data will be saved as follows:\n\n'
'Format:\t%s\nName:\t%s\nFolder:\t%s\n\n'
'Format:\t%(format)s\nName:\t%(name)s\nFolder:\t%(folder)s\n\n'
'Press Apply to proceed, Back to revisit '
'your options, or Cancel to abort') % (format.replace("_",""), name, folder)
'your options, or Cancel to abort') % {
'format': format.replace("_",""),
'name': name,
'folder': folder}
page_complete = True
else :
confirm_text = _(

View File

@ -1681,9 +1681,9 @@ def make_unknown(class_arg, explanation, class_func, commit_func, transaction,
elif isinstance(obj, gen.lib.Tag):
if not hasattr(make_unknown, 'count'):
make_unknown.count = 1 #primitive static variable
obj.set_name(_("Unknown, was missing %s (%d)") %
(time.strftime('%x %X', time.localtime()),
make_unknown.count))
obj.set_name(_("Unknown, was missing %(time)s (%(count)d)") % {
'time': time.strftime('%x %X', time.localtime()),
'count': make_unknown.count})
make_unknown.count += 1
else:
raise TypeError("Object if of unsupported type")

View File

@ -75,7 +75,9 @@ def _errordialog(title, errormessage):
"""
Show the error. A title for the error and an errormessage
"""
print _('ERROR: %s \n %s') % (title, errormessage)
print _('ERROR: %(title)s \n %(message)s') % {
'title': title,
'message': errormessage}
sys.exit()
#-------------------------------------------------------------------------

View File

@ -268,7 +268,10 @@ def load_addon_file(path, callback=None):
# If the plugin is for another version; inform and do nothing
if callback:
callback(" " + (_("'%s' is NOT for this version of Gramps.") % id) + "\n")
callback(" " + (_("It is for version %d.%d" % vtup) + "\n"))
callback(" " + (_("It is for version %(v1)d.%(v2)d") % {
'v1': vtup[0],
'v2': vtup[1]}
+ "\n"))
continue
else:
# another register function doesn't have gramps_target_version

View File

@ -113,12 +113,12 @@ else: # normal case
MIN_PYTHON_VERSION = (2, 6, 0, '', 0)
if not sys.version_info >= MIN_PYTHON_VERSION :
print (_("Your Python version does not meet the "
"requirements. At least python %d.%d.%d is needed to"
"requirements. At least python %(v1)d.%(v2)d.%(v3)d is needed to"
" start Gramps.\n\n"
"Gramps will terminate now.") % (
MIN_PYTHON_VERSION[0],
MIN_PYTHON_VERSION[1],
MIN_PYTHON_VERSION[2]))
"Gramps will terminate now.") % {
'v1': MIN_PYTHON_VERSION[0],
'v2': MIN_PYTHON_VERSION[1],
'v3': MIN_PYTHON_VERSION[2]})
sys.exit(1)
#-------------------------------------------------------------------------

View File

@ -46,8 +46,10 @@ def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
title = title()
filter.set_name(title)
struct_time = time.localtime()
filter.set_comment( _("Created on %4d/%02d/%02d") %
(struct_time.tm_year, struct_time.tm_mon, struct_time.tm_mday))
filter.set_comment( _("Created on %(year)4d/%(month)02d/%(day)02d") % {
'year': struct_time.tm_year,
'month': struct_time.tm_mon,
'day': struct_time.tm_mday})
re = "|".join(["^%s$" % gid for gid in sorted(gramps_ids)])
filter.add_rule(rule([re]))
filterdb = Filters.FilterList(const.CUSTOM_FILTERS)

View File

@ -841,7 +841,10 @@ class GuiFamilyOption(gtk.HBox):
else:
mother_name = _("unknown mother")
name = _("%s and %s (%s)") % (father_name, mother_name, family_id)
name = _("%(father_name)s and %(mother_name)s (%(family_id)s)") % {
'father_name': father_name,
'mother_name': mother_name,
'family_id': family_id}
self.__family_label.set_text( name )
self.__option.set_value(family_id)