From 6881eb2c6f59e2c90b18da7b7d6128eac59dd8c7 Mon Sep 17 00:00:00 2001 From: FUJIWARA Katsunori Date: Sun, 1 Nov 2015 08:38:56 +0900 Subject: [PATCH] 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. --- i18n/check-translation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/i18n/check-translation.py b/i18n/check-translation.py index 398df8a5a6..c259831f80 100644 --- a/i18n/check-translation.py +++ b/i18n/check-translation.py @@ -71,7 +71,9 @@ def promptchoice(pe): deprecatedpe = None @scanner() 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): global deprecatedpe deprecatedpe = pes[0] @@ -108,7 +110,7 @@ def deprecated(pe): >>> match(deprecated, pe) """ if not ('(DEPRECATED)' in pe.msgstr or - (deprecatedpe and deprecatedpe.msgstr and + (deprecatedpe and deprecatedpe.msgstr in pe.msgstr)): yield "msgstr inconsistently translated (DEPRECATED)"