[Zope3-dev] i18nextract changes if you are interested.
Giovannetti, Mark
giovanne at nrcan.gc.ca
Tue Mar 6 15:43:15 EST 2007
Hello,
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? ;-)
Regards.
Mark
zope# diff bin/i18nextract.ccrs bin/i18nextract.dist
15,19d14
< #
< # Local modifications by Mark V. Giovannetti Mar. 6, 2007
< # for the purpose of specifying python, zcml, and/or page templates
< # or a combination thereof.
< #
37d31
<
42c36
< Specifies the domain that is supposed to be extracted (i.e. 'zope').
---
> Specifies the domain that is supposed to be extracted (i.e. 'zope')
44c38
< Specifies the package that is supposed to be searched.
---
> Specifies the package that is supposed to be searched
51,70c45
< 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.
114,115c89,90
< 'hd:p:o:x:pczt',
< ['help', 'domain=', 'path=', 'python-only', 'code', 'zcml', 'pagetemplate'])
---
> 'hd:p:o:x:',
> ['help', 'domain=', 'path=', 'python-only'])
125,130d99
< have_search_code = False
< have_search_zcml = False
< have_search_pagetemplate = False
< search_code = True
< search_zcml = True
< search_pagetemplate = True
141,146d109
< 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
149,151d111
< have_search_code = True
< have_search_zcml = False
< have_search_pagetemplate = False
164,168d123
< 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
<
186d140
< from zope.app.locales.pygettext import make_escapes
189,198c143,146
< # 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')
200,202d147
<
< if search_pagetemplate:
< print "Searching page templates."
204,208c149
<
< if search_code or search_zcml or search_pagetemplate:
< maker.write()
< else:
< print "Nothing to search. Please see --help"
---
> maker.write()
--
613-947-1359
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
More information about the Zope3-dev
mailing list