[Mailman-Developers] Problems with Vietnamese translation

Mark Sapiro msapiro at value.net
Thu Apr 27 05:07:31 CEST 2006


Mark Sapiro wrote:
>
>It shouldn't be difficult to work up a patch to po2templ.py (using re)
>that would make it more robust in this area. I'm willing to do that,
>but I may not have time to get to it for a few days.


Here's a patch

--- MM-Trunk/mailman/bin/po2templ.py 2006-04-18 18:06:32.484375000 -0700
+++ test-mailman-trunk/bin/po2templ.py 2006-04-26 19:42:24.843750000
-0700
@@ -27,8 +27,11 @@
 Usage: po2templ.py languages
 """

+import re
 import sys

+cre = re.compile('^#:[ ]*templates/en/(?P<filename>.*):1')
+

 ?
 def do_lang(lang):
@@ -38,10 +41,11 @@
     fp = file('messages/%s/LC_MESSAGES/mailman.po' % lang)
     try:
         for line in fp:
-            if line.startswith('#: templates'):
+            m = re.search(cre, line)
+            if m:
                 in_template = True
                 in_msg = False
-                filename = line[16:-3]
+                filename = m.group('filename')
                 outfilename = 'templates/%s/%s' % (lang, filename)
                 continue
             if in_template and line.startswith('#,'):


I tested this and it seems to work fine whether or not mailman.po has a
space after the '#:'.

Tokio,

Do you think we should go ahead and commit this on the trunk?

-- 
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Developers mailing list