[Zope3-checkins] CVS: Zope3/src/zope/app/translation_files - extract.py:1.4

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Aug 5 10:49:01 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/translation_files
In directory cvs.zope.org:/tmp/cvs-serv8764

Modified Files:
	extract.py 
Log Message:
Fixed up a few things, so that we are generating 100% valid POT files.


=== Zope3/src/zope/app/translation_files/extract.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/translation_files/extract.py:1.3	Mon Aug  4 15:20:31 2003
+++ Zope3/src/zope/app/translation_files/extract.py	Tue Aug  5 09:48:54 2003
@@ -59,7 +59,7 @@
 
     def write(self, file):
         file.write(self.comments)
-        file.write('msgid %s' % self.msgid)
+        file.write('msgid %s\n' %normalize(self.msgid))
         file.write('msgstr ""\n')
         file.write('\n')
 
@@ -77,7 +77,8 @@
 
     def add(self, strings, base_dir=None):
         for msgid, locations in strings.items():
-            msgid = '"%s"\n' %msgid
+            if msgid == '':
+                continue
             if msgid not in self.catalog:
                 self.catalog[msgid] = POTEntry(msgid)
 
@@ -184,8 +185,6 @@
             rentries = reverse[rkey]
             rentries.sort()
             for msgid, locations in rentries:
-                # Normalize and take off surrounding quotes (we do that later)
-                msgid = normalize(msgid)[1:-1]
                 catalog[msgid] = []
                 
                 locations = locations.keys()
@@ -235,7 +234,7 @@
     """Retrieve all Python messages from dir that are in the domain."""
     eater = TokenEater()
     make_escapes(0)
-    for filename in find_files(dir, '*.py'):
+    for filename in find_files(dir, '*.py', exclude=('extract.py',)):
         fp = open(filename)
         try:
             eater.set_filename(filename)




More information about the Zope3-Checkins mailing list