I18n messages: priority of messages from multiple PO files
I have created a schemaextender package in which I try to override certain strings for domains bika
and plone
. The source for my new package is here: https://github.com/rockfruit/bika.uw.git
The installation method that I recommend and use (for all addons / plone instances) is this:
- Install Plone UnifiedInstaller.
- change the 'eggs =' and 'develop =' lines to include "bika.lims" and "bika.uw".
- run bin / buildout
With this set method, my overrides are not overriding. In zope.i18n I see that translationdomain.py always prefers the original translations and only uses those from the schemaextender package when bika
there is no identical string in the original directory (i.e. For messages translated to Python or TAL code, the extension package itself, in all my new directories are ignored in Bika or Plone codes).
I read that the zcml = section in buildout.cfg can be used to force the zcml load order to be changed, resulting in messages being preferred from previously downloaded packages. So I tried to change as shown below, however directory from bika.lims
is still preferred:
zcml = Products.CMFPlone bika.uw bika.lims
Now, here is the clue I found. The github repository I linked to above has a root buildout.cfg file that doesn't use UnifiedInstaller but downloads Plone and other dependencies directly. It does not contain the line zcml =. But surprisingly (to me), overriding translations for both domains works (like purchased!) When using this setup method:
git clone https://github.com/rockfruit/bika.uw.git
cd bika.uw
virtualenv .
./bin/pip install zc.buildout
bin/buildout
bin/zeoserver fg & # no idea why 'start' does not work
bin/zeoclient fg
My question is, what am I doing wrong that the normal and recommended installation procedure does not allow my translation overrides from their legal priority?
I'm ashamed to admit it, but I don't care: it puzzled me a little.
I have pasted my existing buildout.cfg below in which I tried to reproduce the behavior of the bika.uw.git / buildout.cfg file this morning with no success.
[buildout]
# buildout-original.cfg is the Plone 4.3.4 zeocluster unified-installer file.
extends =
buildout-original.cfg
zeo-address = 8081
client1-address = 8085
client2-address = 8086
effective-user = campbell
buildout-user = campbell
user=admin:adminsecret
need-sudo = no
var-dir=${buildout:directory}/var
backups-dir=${buildout:directory}/backups
deprecation-warnings = on
verbose-security = on
eggs =
bika.uw
bika.lims
pudb
i18ndude
test
robot
zest.releaser
develop +=
/home/campbell/Plone/repos/bika.uw
/home/campbell/Plone/repos/bika.lims
parts =
zeoserver
client1
client2
backup
zopepy
unifiedinstaller
zcml =
[zeoserver]
<= zeoserver_base
recipe = plone.recipe.zeoserver
zeo-address = 127.0.0.1:${buildout:zeo-address}
zserver-threads = 1
[client1]
<= client_base
recipe = plone.recipe.zope2instance
zeo-address = ${zeoserver:zeo-address}
http-address = ${buildout:client1-address}
resources = ${buildout:directory}/resources
locales = ${buildout:directory}/locales
[client2]
<= client_base
recipe = plone.recipe.zope2instance
zeo-address = ${zeoserver:zeo-address}
http-address = ${buildout:client2-address}
resources = ${buildout:directory}/resources
locales = ${buildout:directory}/locales
[versions]
Cheetah = 2.2.1
plone.recipe.command = 1.1
plone.recipe.precompiler = 0.6
plone.recipe.unifiedinstaller = 4.3.1
Products.DocFinderTab = 1.0.5
ZopeSkel = 2.21.2
collective.recipe.backup = 2.14
zopeskel.dexterity = 1.5.3
zopeskekel.dexterity = 1.5.3
zopeskel.diazotheme = 1.1
source to share
I think the list I made for the talk , which I gave at the 2012 Arnhem Plone conference, is still accurate. This is the order of loading po files:
- locales = $ {buildout: directory} / locales
- zcml = your.package
- Products in alphabetical order up to and including Products.CMFPlone
- packages registered with z3c.autoinclude
- other products
- i18n folders (made by PlacelessTranslationService)
In your case: remove Products.CMFPlone from the zcml parameter. He mixes order.
source to share