From 0145b5ea22a213496a783e910a7964299529a122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Thu, 19 Apr 2012 13:44:56 +0000 Subject: [PATCH] Use named_arguments for translators (patch by MathieuMD) svn: r19358 --- src/ExportAssistant.py | 7 +++++-- src/Utils.py | 6 +++--- src/cli/clidbman.py | 4 +++- src/gen/plug/utils.py | 5 ++++- src/gramps.py | 10 +++++----- src/gui/makefilter.py | 6 ++++-- src/gui/plug/_guioptions.py | 5 ++++- 7 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/ExportAssistant.py b/src/ExportAssistant.py index 2a9d0f9cd..09d1a150d 100644 --- a/src/ExportAssistant.py +++ b/src/ExportAssistant.py @@ -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 = _( diff --git a/src/Utils.py b/src/Utils.py index 1078fcdcb..729ed45d9 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -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") diff --git a/src/cli/clidbman.py b/src/cli/clidbman.py index d917b5cca..597b18fae 100644 --- a/src/cli/clidbman.py +++ b/src/cli/clidbman.py @@ -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() #------------------------------------------------------------------------- diff --git a/src/gen/plug/utils.py b/src/gen/plug/utils.py index c32e39f87..853e27f6f 100644 --- a/src/gen/plug/utils.py +++ b/src/gen/plug/utils.py @@ -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 diff --git a/src/gramps.py b/src/gramps.py index c9dfe5859..d5dffce5d 100644 --- a/src/gramps.py +++ b/src/gramps.py @@ -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) #------------------------------------------------------------------------- diff --git a/src/gui/makefilter.py b/src/gui/makefilter.py index 9e0587ad6..a9965cfad 100644 --- a/src/gui/makefilter.py +++ b/src/gui/makefilter.py @@ -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) diff --git a/src/gui/plug/_guioptions.py b/src/gui/plug/_guioptions.py index c17713d12..f3ef54754 100644 --- a/src/gui/plug/_guioptions.py +++ b/src/gui/plug/_guioptions.py @@ -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)