Patchwork [STABLE] i18n: make empty string not i18n-ed to avoid hiding translation meta data

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Nov. 1, 2014, 10:22 a.m.
Message ID <abe750321a0fc546af05.1414837332@feefifofum>
Download mbox | patch
Permalink /patch/6503/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Nov. 1, 2014, 10:22 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1414837160 -32400
#      Sat Nov 01 19:19:20 2014 +0900
# Branch stable
# Node ID abe750321a0fc546af053cb1c3b75fbf815b0281
# Parent  2dc6b7917cdfbba243ecbaad93b2d375124e8521
i18n: make empty string not i18n-ed to avoid hiding translation meta data

Before this patch, empty i18n-ed string for "debuglocks" command hides
translation meta data in "hg.pot" file, because translation meta data
is also identified by empty msgid ("").

Lack of translation meta data in "hg.pot" prevents "msgmerge" command
from updating corresponded meta data fields in each "*.po" files.

The root cause of this problem is combination of behavior below:

  - "xgettext" writes the entry of empty i18n-ed string for
    "debuglock" (= empty msgid) with metadata in the middle of the POT
    file, but

  - "polib" (used by "i18n/posplit") treats the entry of empty msgid
    as meta data, only if it is the 1st one of all entries in POT file

This patch just makes empty string not i18n-ed to fix this problem
easily, because changing behavior above seems to be too complicated,
even though we would have to introduce something to avoid this kind of
regression in the future.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2352,7 +2352,7 @@ 
          [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')),
           ('W', 'force-wlock', None,
            _('free the working state lock (DANGEROUS)'))],
-         _(''))
+         '')
 def debuglocks(ui, repo, **opts):
     """show or modify state of locks