Update of /cvsroot/mailman/mailman/bin
In directory sc8-pr-cvs1:/tmp/cvs-serv9225

Modified Files:
        transcheck 
Log Message:
Simone's patch for bug #658261, "transcheck error for double %".


Index: transcheck
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/transcheck,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -d -r2.5 -r2.6
--- transcheck  28 Oct 2002 03:20:27 -0000      2.5
+++ transcheck  17 Mar 2003 04:28:33 -0000      2.6
@@ -55,14 +55,19 @@
 
 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 @@
     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 @@
        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 @@
     "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()



_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to