[Zope-dev] z3c.recipe.i18n and zope.app.locales.extract

yuppie y.2009 at wcm-solutions.de
Wed Jul 15 15:04:14 EDT 2009


Hi!


I plan to use z3c.recipe.i18n for some Zope 2 CMF products. But to get 
things working I did have to modify z3c.recipe.i18n a bit.

It would be nice if I could get some feedback regarding the issues I found:

1.) running tests
-----------------

test.py tries to install 'zodbcode' and 'zope.app.interface'. That 
doesn't work for me. AFAICS those two eggs are no longer indirect 
testing dependencies. After removing those two lines all tests pass.

Proposal: Remove those two lines in test.py.

2.) looking up the product version
----------------------------------

POTMaker._getProductVersion() doesn't work for me. 
zope.app.applicationcontrol is not used by Zope 2 and is not part of the 
specified dependencies. This raises an error.

Proposal: Catch the error. Return an empty string if version is not found.

3.) customizing the .pot header
-------------------------------

POTMaker.write() uses a harcoded Zope 3 specific pot_header template.

Proposal: The easiest and most flexible way to customize this seems to 
be an option that allows to specify a file that contains the pot_header 
template.

4.) looking up basePath
-----------------------

i18nextract.main() contains these lines:

     # add maker for each given path
     for pkgName, path in eggPaths:
         srcIdx = path.rfind('src')
         if srcIdx == -1:
             # this is an egg package, strip down base path
             basePath = path
             moduleNames = pkgName.split('.')
             moduleNames.reverse()
             for mName in moduleNames:
                 mIdx = path.rfind(mName)
                 basePath = basePath[:mIdx]
             pkgPath = path[len(basePath):]
         else:
             # this is a package linked in as externals
             basePath = path[:srcIdx]
             pkgPath = path[len(basePath):]

I don't understand why we need different code for "packages linked in as 
externals". The "egg package" code works actually better for linked in 
packages that don't follow the 'src' convention.

Proposal: Use the 'if' code for all packages.

5. writing makers
-----------------

I'd like to specify additional makers. This is a nice hook, but why are 
only these three arguments passed to custom poMakers?

             maker.add(poMaker(path, basePath, exclude_dirs), basePath)

I miss 'domain' and 'include_default_domain'.

Proposal: Pass in the additional arguments and fall back to the old 
signature for BBB.


Does all that make sense? Any objections or better ideas?

Should changes for POTMaker go into zope.app.locales.extract or should 
z3c.recipe.i18n use a customized version?


Cheers,

	Yuppie



More information about the Zope-Dev mailing list