comparison 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
comparison
equal deleted inserted replaced
23966:2d2c0a8eeeb8 23967:448bb32b8ee6
917 if name == 'branches': 917 if name == 'branches':
918 continue 918 continue
919 # we will use the templatename as the color name since those two 919 # we will use the templatename as the color name since those two
920 # should be the same 920 # should be the same
921 for name in ns.names(self.repo, changenode): 921 for name in ns.names(self.repo, changenode):
922 # i18n: column positioning for "hg log" 922 self.ui.write(ns.logfmt % name,
923 name = _(("%s:" % ns.logname).ljust(13) + "%s\n") % name 923 label='log.%s' % ns.colorname)
924 self.ui.write("%s" % name, label='log.%s' % ns.colorname)
925 if self.ui.debugflag: 924 if self.ui.debugflag:
926 # i18n: column positioning for "hg log" 925 # i18n: column positioning for "hg log"
927 self.ui.write(_("phase: %s\n") % _(ctx.phasestr()), 926 self.ui.write(_("phase: %s\n") % _(ctx.phasestr()),
928 label='log.phase') 927 label='log.phase')
929 for parent in parents: 928 for parent in parents: