diff mercurial/cmdutil.py @ 23967:448bb32b8ee6 stable

namespace: introduce logfmt to show l10n-ed messages for hg log correctly Before this patch, "_()" is used incorrectly for "tag:" and "bookmark:" fields. "changeset_printer()" looks up keys composed at runtime, and it prevents "xgettext" command from getting strings to be translated from source files. Then, *.po files merged with updated "hg.pot" lose msgids for "tag:" and "bookmark:". This patch introduces "logfmt" information into "namespace" to show l10n-ed messages "hg log" (or "changeset_printer()") correctly. For similarity to other namespaces, this patch specifies "logfmt" for "branches" namespace, even though it isn't needed (branch information is handled in "changeset_printer()" specially). To find related code paths out easily, this patch adds "i18n: column positioning ..." comment to the line composing "logfmt" by default, even though this line itself doesn't contain any strings to be translated.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 28 Jan 2015 22:22:59 +0900
parents 6156edaa82aa
children 942a5a34b2d0
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Jan 27 10:17:16 2015 -0500
+++ b/mercurial/cmdutil.py	Wed Jan 28 22:22:59 2015 +0900
@@ -919,9 +919,8 @@
             # we will use the templatename as the color name since those two
             # should be the same
             for name in ns.names(self.repo, changenode):
-                # i18n: column positioning for "hg log"
-                name = _(("%s:" % ns.logname).ljust(13) + "%s\n") % name
-                self.ui.write("%s" % name, label='log.%s' % ns.colorname)
+                self.ui.write(ns.logfmt % name,
+                              label='log.%s' % ns.colorname)
         if self.ui.debugflag:
             # i18n: column positioning for "hg log"
             self.ui.write(_("phase:       %s\n") % _(ctx.phasestr()),