Using zope 3.3.0 so i18nextract may have changed.

I found that i18nextract didn't quite meet my needs.
So I changed it.  The following diff shows the changes.
Basically, I wanted to allow individual py/zcml/pt 
extractions to be possible.  

Originally, python code is always included in an
extraction.  This leads to duplication within .pot files
when there is more than one translation domain.  
So a common look and feel domain stored entirely in zcml or
page templates can now be extracted without pulling
in a pile of irrelevant python messages.

The default behaviour is unchanged. 

I hope you can make use of the changes.  bin/i18nextract.ccrs
was the new version.  Am I using diff with the arguments the
right way around? ;-)


zope# diff bin/i18nextract.ccrs bin/i18nextract.dist
< #
< # Local modifications by Mark V. Giovannetti Mar. 6, 2007
< # for the purpose of specifying python, zcml, and/or page templates
< # or a combination thereof.
< #
<         Specifies the domain that is supposed to be extracted (i.e. 'zope').
>         Specifies the domain that is supposed to be extracted (i.e. 'zope')
<         Specifies the package that is supposed to be searched.
>         Specifies the package that is supposed to be searched
<         May be used more than once.  Does not apply to ZCML files.
<         Applies to python and templates only.
<     --python-only
<         Obsolete.  See -c / --code  If this is specified then zcml
<         and page templates will not be searched, depending on option
<         order.  For example --python--only --zcml will search code
<         and zcml whereas --zcml --python-only will search code only
<         since --zcml will be overridden by --python-only.
<     -c / --code
<         Look through python code.
<     -z / --zcml
<         Look through ZCML configuration files.
<     -t / --pagetemplate
<         Look through zope page template files.
< If none of -z, -t, or -c are specified then all are enabled and
< all of code, zcml and page templates are searched..
< If any are specified then the others default to false unless
< also specified.  Best not to mix them with python-only.
>         May be used more than once.
<             'hd:p:o:x:pczt',
<             ['help', 'domain=', 'path=', 'python-only', 'code', 'zcml', 
>             'hd:p:o:x:',
>             ['help', 'domain=', 'path=', 'python-only'])
<     have_search_code = False
<     have_search_zcml = False
<     have_search_pagetemplate = False
<     search_code = True
<     search_zcml = True
<     search_pagetemplate = True
<         elif opt in ('-c', '--code'):
<             have_search_code = True
<         elif opt in ('-z', '--zcml'):
<             have_search_zcml = True
<         elif opt in ('-t', '--pagetemplate'):
<             have_search_pagetemplate = True
<             have_search_code = True
<             have_search_zcml = False
<             have_search_pagetemplate = False
<     if have_search_code or have_search_zcml or have_search_pagetemplate:
<         search_code = have_search_code
<         search_zcml = have_search_zcml
<         search_pagetemplate = have_search_pagetemplate
<     from zope.app.locales.pygettext import make_escapes
<     # make_escapes is still called within py_strings.  If we don't call it
<     # here then tal_strings fails with an index error when calling escape.
<     make_escapes(0)
<     if search_code:
<         print "Searching code."
<         maker.add(py_strings(path, domain, exclude=exclude_dirs), base_dir)
<     site_zcml = os.path.join(INSTANCE_HOME, 'etc', 'site.zcml')
<     if search_zcml:
<         print "Searching ZCML."
>     maker.add(py_strings(path, domain ), base_dir)
>     #maker.add(py_strings(path, domain, exclude=exclude_dirs), base_dir)
>     if not python_only:
>         site_zcml = os.path.join(INSTANCE_HOME, 'etc', 'site.zcml')
<     if search_pagetemplate:
<         print "Searching page templates."
<     if search_code or search_zcml or search_pagetemplate:
<         maker.write()
<     else:
<         print "Nothing to search.  Please see --help"
>     maker.write()

System Scientist / Scientifique, spécialiste des systèmes
Canada Centre for Remote Sensing / Centre canadien de télédéction
Natural Resources Canada, 588 Booth Street, Ottawa, Ontario, Canada, K1A 0Y7
Ressources naturelles Canada, 588 rue Booth, Ottawa, Ontario, Canada, K1A 0Y7
Government of Canada / Gouvernement du Canada
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to