diff i18n/check-translation.py @ 26837:33894facc180 stable

i18n: fix regexp pattern to detect translation for DEPRECATED Since 44cc9f63a2f1, deprecated commands, options and so on are detected by "(DEPRECATED)" instead of "DEPRECATED". Therefore, 'deprecated' checker in i18n/check-translation.py should check translation, of which msgid contains "(DEPRECATED)" instead of "DEPRECATED". At glance, it seems to do so, but it actually doesn't, because Python regexp treats "()" as grouping of patterns and "(DEPRECATED)" matches only against "DEPRECATED".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 01 Nov 2015 08:38:56 +0900
parents ad4d6c7aea6a
children 47dd34f2e727
line wrap: on
line diff
--- a/i18n/check-translation.py	Sat Oct 31 21:45:46 2015 -0400
+++ b/i18n/check-translation.py	Sun Nov 01 08:38:56 2015 +0900
@@ -76,7 +76,7 @@
         global deprecatedpe
         deprecatedpe = pes[0]
 
-@fatalchecker('(DEPRECATED)')
+@fatalchecker(r'\(DEPRECATED\)')
 def deprecated(pe):
     """Check for DEPRECATED
     >>> ped = polib.POEntry(
@@ -102,6 +102,10 @@
     True
     >>> for e in deprecated(pe): print e
     msgstr inconsistently translated (DEPRECATED)
+    >>> pe = polib.POEntry(
+    ...     msgid = 'Something (DEPRECATED, foo bar)',
+    ...     msgstr= 'something (DETACERPED, foo bar)')
+    >>> match(deprecated, pe)
     """
     if not ('(DEPRECATED)' in pe.msgstr or
             (deprecatedpe and deprecatedpe.msgstr and