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

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Aug 12 16:13:23 EDT 2003


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

Modified Files:
	talgettext.py 
Log Message:
Made talgettext domain aware. The command line version does not support it
yet though. Someone who uses the command line version should test it. Zope
only uses the setup, i.e. the POEngine, which stores catalogs now.

Tests were adjusted.


=== Zope3/src/zope/tal/talgettext.py 1.14 => 1.15 ===
--- Zope3/src/zope/tal/talgettext.py:1.14	Tue Jun  3 11:20:06 2003
+++ Zope3/src/zope/tal/talgettext.py	Tue Aug 12 15:12:48 2003
@@ -110,11 +110,14 @@
                   # XXX position is not part of the ITALExpressionEngine
                   #     interface
                   position=None):
-        # assume domain and mapping are ignored; if they are not,
-        # unit test must be updated.
-        if msgid not in self.catalog:
-            self.catalog[msgid] = []
-        self.catalog[msgid].append((self.file, position))
+
+        if domain not in self.catalog:
+            self.catalog[domain] = {}
+        domain = self.catalog[domain]
+
+        if msgid not in domain:
+            domain[msgid] = []
+        domain[msgid].append((self.file, position))
         return 'x'
 
 
@@ -273,7 +276,11 @@
     else:
         outfile = file(outfile, update_mode and "a" or "w")
 
-    messages = engine.catalog.copy()
+    catalog = {}
+    for domain in engine.catalog.keys():
+        catalog.update(engine.catalog[domain])
+
+    messages = catalog.copy()
     try:
         messages.update(engine.base)
     except AttributeError:
@@ -282,7 +289,8 @@
         print >> outfile, pot_header % {'time': time.ctime(),
                                         'version': __version__}
 
-    msgids = engine.catalog.keys()
+    msgids = catalog.keys()
+    # XXX: You should not sort by msgid, but by filename and position. (SR)
     msgids.sort()
     for msgid in msgids:
         positions = engine.catalog[msgid]




More information about the Zope3-Checkins mailing list