mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
i18n: look translation of both "DEPRECATED" and "(DEPRECATED)" up
Since f94973e0eefb, deprecated commands, options and so on are detected by "(DEPRECATED)" instead of "DEPRECATED". "hg.pot" generated from recent source files doesn't contain msgid "DEPRECATED", and looking the translation of "DEPRECATED" up in up-to-date *.po files works incorrectly. But on the other hand, there are still old *.po files, which contain msgid "DEPRECATED" but not "(DEPRECATED)". Looking the translation of "(DEPRECATED)" up in such old *.po files also works incorrectly. This patch resolves this problem by looking translation of both "DEPRECATED" and "(DEPRECATED)" up. This should work correctly, because previous patch makes "deprecated" checker be applied only on translations, of which msgid contains exact "(DEPRECATED)" string. 'p.msgstr' examination in 'deprecatedsetup()' is needed to ignore untranslated entries. This also makes 'deprecatedpe.msgstr' examination in 'deprecated()' meaningless.
This commit is contained in:
parent
7c484b491b
commit
6881eb2c6f
@ -71,7 +71,9 @@ def promptchoice(pe):
|
|||||||
deprecatedpe = None
|
deprecatedpe = None
|
||||||
@scanner()
|
@scanner()
|
||||||
def deprecatedsetup(pofile):
|
def deprecatedsetup(pofile):
|
||||||
pes = [p for p in pofile if p.msgid == 'DEPRECATED']
|
pes = [p for p in pofile
|
||||||
|
if ((p.msgid == 'DEPRECATED' or p.msgid == '(DEPRECATED)') and
|
||||||
|
p.msgstr)]
|
||||||
if len(pes):
|
if len(pes):
|
||||||
global deprecatedpe
|
global deprecatedpe
|
||||||
deprecatedpe = pes[0]
|
deprecatedpe = pes[0]
|
||||||
@ -108,7 +110,7 @@ def deprecated(pe):
|
|||||||
>>> match(deprecated, pe)
|
>>> match(deprecated, pe)
|
||||||
"""
|
"""
|
||||||
if not ('(DEPRECATED)' in pe.msgstr or
|
if not ('(DEPRECATED)' in pe.msgstr or
|
||||||
(deprecatedpe and deprecatedpe.msgstr and
|
(deprecatedpe and
|
||||||
deprecatedpe.msgstr in pe.msgstr)):
|
deprecatedpe.msgstr in pe.msgstr)):
|
||||||
yield "msgstr inconsistently translated (DEPRECATED)"
|
yield "msgstr inconsistently translated (DEPRECATED)"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user