[Zope3-checkins] CVS: Zope3/src/zope/tal - talgettext.py:1.4

Nathan R. Yergler nathan@yergler.net
Wed, 26 Mar 2003 10:24:16 -0500


Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv26150

Modified Files:
	talgettext.py 
Log Message:
Fixed bug in --update mode which borked existing multi-line translations in the .po file.


=== Zope3/src/zope/tal/talgettext.py 1.3 => 1.4 ===
--- Zope3/src/zope/tal/talgettext.py:1.3	Tue Mar 25 18:46:03 2003
+++ Zope3/src/zope/tal/talgettext.py	Wed Mar 26 10:24:16 2003
@@ -32,6 +32,7 @@
 import getopt
 import os
 import sys
+import string
 
 from zope.tal.htmltalparser import HTMLTALParser
 from zope.tal.talinterpreter import TALInterpreter
@@ -73,6 +74,11 @@
     def __add(self, id, str, fuzzy):
         "Add a non-fuzzy translation to the dictionary."
         if not fuzzy and str:
+            # check for multi-line values and munge them appropriately
+            if ('\n' in str):
+                str = '\n' + str
+                lines = str.split('\n')
+                str = string.join (lines, '"\n"')
             self.catalog[id] = str
 
     def _loadFile(self):
@@ -182,7 +188,6 @@
         engine = POEngine()
         
     for file in args:
-        print file
         p = HTMLTALParser()
         p.parseFile(file)
         program, macros = p.getCode()