[Zope3-checkins] SVN: Zope3/trunk/ - Fixed a serious issue with selecting the default domain messages as

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu May 11 14:59:24 EDT 2006


Log message for revision 68098:
  - Fixed a serious issue with selecting the default domain messages as 
    well. It was getting the 'zope' domain instead.
  
  - Enhanced I18n message extraction script, so that is can be more easily 
    used by applications with a different directory layout.
  
  

Changed:
  U   Zope3/trunk/src/zope/app/locales/extract.py
  U   Zope3/trunk/utilities/i18nextract.py

-=-
Modified: Zope3/trunk/src/zope/app/locales/extract.py
===================================================================
--- Zope3/trunk/src/zope/app/locales/extract.py	2006-05-11 16:06:30 UTC (rev 68097)
+++ Zope3/trunk/src/zope/app/locales/extract.py	2006-05-11 18:59:24 UTC (rev 68098)
@@ -411,7 +411,7 @@
     # When the Domain is 'default', then this means that none was found;
     # Include these strings; yes or no?
     if include_default_domain:
-        catalog.update(engine.catalog['zope'])
+        catalog.update(engine.catalog['default'])
     for msgid, locations in catalog.items():
         catalog[msgid] = map(lambda l: (l[0], l[1][0]), locations)
     return catalog

Modified: Zope3/trunk/utilities/i18nextract.py
===================================================================
--- Zope3/trunk/utilities/i18nextract.py	2006-05-11 16:06:30 UTC (rev 68097)
+++ Zope3/trunk/utilities/i18nextract.py	2006-05-11 18:59:24 UTC (rev 68098)
@@ -37,18 +37,26 @@
     -p / --path <path>
         Specifies the package that is supposed to be searched
         (i.e. 'zope/app')
+    -s / --site_zcml <path>
+        Specify the location of the 'site.zcml' file. By default the regular
+        Zope 3 one is used.
+    -e / --exclude-default-domain
+        Exclude all messages found as part of the default domain. Messages are
+        in this domain, if their domain could not be determined. This usually
+        happens in page template snippets.
     -o dir
         Specifies a directory, relative to the package in which to put the
         output translation template.
     -x dir
         Specifies a directory, relative to the package, to exclude.
         May be used more than once.
+    --python-only
+        Only extract message ids from Python
 
 $Id$
 """
 
 import os, sys, getopt
-
 def usage(code, msg=''):
     # Python 2.1 required
     print >> sys.stderr, __doc__
@@ -84,8 +92,8 @@
     try:
         opts, args = getopt.getopt(
             sys.argv[1:],
-            'hd:p:o:x:',
-            ['help', 'domain=', 'path=', 'python-only'])
+            'hd:s:i:p:o:x:',
+            ['help', 'domain=', 'site_zcml=', 'path=', 'python-only'])
     except getopt.error, msg:
         usage(1, msg)
 
@@ -94,12 +102,16 @@
     include_default_domain = True
     output_dir = None
     exclude_dirs = []
-    python_only = None
+    python_only = False
+    site_zcml = None
     for opt, arg in opts:
         if opt in ('-h', '--help'):
             usage(0)
         elif opt in ('-d', '--domain'):
             domain = arg
+        elif opt in ('-s', '--site_zcml'):
+            site_zcml = arg
+        elif opt in ('-e', '--exclude-default-domain'):
             include_default_domain = False
         elif opt in ('-o', ):
             output_dir = arg
@@ -133,10 +145,14 @@
 
     print "base path: %r\n" \
           "search path: %s\n" \
+          "'site.zcml' location: %s\n" \
           "exclude dirs: %r\n" \
           "domain: %r\n" \
-          "output file: %r" \
-          % (base_dir, path, exclude_dirs, domain, output_file)
+          "include default domain: %r\n" \
+          "output file: %r\n" \
+          "Python only: %r" \
+          % (base_dir, path, site_zcml, exclude_dirs, domain,
+             include_default_domain, output_file, python_only)
 
     from zope.app.locales.extract import POTMaker, \
          py_strings, tal_strings, zcml_strings
@@ -144,7 +160,7 @@
     maker = POTMaker(output_file, path)
     maker.add(py_strings(path, domain, exclude=exclude_dirs), base_dir)
     if not python_only:
-        maker.add(zcml_strings(path, domain), base_dir)
+        maker.add(zcml_strings(path, domain, site_zcml), base_dir)
         maker.add(tal_strings(path, domain, include_default_domain,
                               exclude=exclude_dirs), base_dir)
     maker.write()



More information about the Zope3-Checkins mailing list