diff options
author | bwarsaw <> | 2003-03-31 20:07:57 +0000 |
---|---|---|
committer | bwarsaw <> | 2003-03-31 20:07:57 +0000 |
commit | d258eeb3b86fc7a084e68428f3354789ef8e3b4c (patch) | |
tree | c5e669fcefd0fa98790159734d09c0d37d63c204 /bin/transcheck | |
parent | 5a6aeea41cd141bc4e962381284cbeeefa7bf4d9 (diff) | |
download | mailman2-d258eeb3b86fc7a084e68428f3354789ef8e3b4c.tar.gz mailman2-d258eeb3b86fc7a084e68428f3354789ef8e3b4c.tar.xz mailman2-d258eeb3b86fc7a084e68428f3354789ef8e3b4c.zip |
Backporting various fixes and improvements from the trunk.
Diffstat (limited to '')
-rwxr-xr-x | bin/transcheck | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bin/transcheck b/bin/transcheck index fbb0dcd8..78d1b6d1 100755 --- a/bin/transcheck +++ b/bin/transcheck @@ -55,14 +55,19 @@ def usage(code, msg=''): class TransChecker: "check a translation comparing with the original string" - def __init__(self, regexp): + def __init__(self, regexp, escaped=None): self.dict = {} self.errs = [] self.regexp = re.compile(regexp) + self.escaped = None + if escaped: + self.escaped = re.compile(escaped) def checkin(self, string): "scan a string from the original file" for key in self.regexp.findall(string): + if self.escaped and self.escaped.match(key): + continue if self.dict.has_key(key): self.dict[key] += 1 else: @@ -71,6 +76,8 @@ class TransChecker: def checkout(self, string): "scan a translated string" for key in self.regexp.findall(string): + if self.escaped and self.escaped.match(key): + continue if self.dict.has_key(key): self.dict[key] -= 1 else: @@ -273,9 +280,9 @@ def check_file(translatedFile, originalFile, html=0, quiet=0): search also <MM-*> tags if html is not zero""" if html: - c = TransChecker("(%\([^)]+\)[0-9]*[sd]|</?MM-[^>]+>)") + c = TransChecker("(%%|%\([^)]+\)[0-9]*[sd]|</?MM-[^>]+>)", "^%%$") else: - c = TransChecker("(%\([^)]+\)[0-9]*[sd])") + c = TransChecker("(%%|%\([^)]+\)[0-9]*[sd])", "^%%$") try: f = open(originalFile) @@ -319,7 +326,7 @@ def check_po(file, quiet=0): "scan the po file comparing msgids with msgstrs" n = 0 p = POParser(file) - c = TransChecker("(%\([^)]+\)[0-9]*[sdu]|%[0-9]*[sdu])") + c = TransChecker("(%%|%\([^)]+\)[0-9]*[sdu]|%[0-9]*[sdu])", "^%%$") while p.parse(): if p.msgstr: c.reset() |