Maurits van Rees

Document Actions

i18n, locales and Plone 3.0

More and more products are developed as python packages instead of Zope products. This means they should not be put in the Products directory anymore, but in the lib/python/ directory of your instance. How you handle translations has changed a bit because of that. Also with Zope 2.10 and higher the translation machinery has changed a bit. So how should you handle translations now?

Most translations should now be put in the locales directory of
your product or package. This directory must be registered in zcml
before it is picked up on Zope startup. So in your configure.zcml
add:

If you want to add translations to the plone domain you could add
locales/plone.pot and locales/nl/LC_MESSAGES/plone.po (or
locales/plone-mydomain.pot and
locales/nl/LC_MESSAGES/plone-mydomain.po if you want). That
works: your translations for the plone domain are then available. But
now the default translations for the plone domain (so those from
PloneTranslations) are overridden. This is because your translations
for the plone domain are picked up first by the zope translation
machinery; the PlacelessTranslationService that normally loads the
translations from PloneTranslations then gets ignored for the plone
domain. So half your site is in English even though your browser is
set to Dutch.

So extra translations for the plone domain should not be done in the
locales directory. You can still put them in the i18n
directory though. In Plone 3.5 this is likely to change.

As Hanno Schlichting tells me, the same is of course true for the other domains in PloneTranslations, like atcontenttypes, cmfeditions, plonelanguagetool, etcetera.

The i18n:domain should be plone and not for instance
mydomain as these translations are used in templates of plone
itself. In fact, I think that the only use for having these i18n
commands in the .xml files is that they can then be extracted by
i18ndude (version 3.0 I think, which is best installed in a
workingenv).

.po files in i18n are compiled on zope startup time by the
PlacelessTranslationService. With compiling I mean: turning them into
.mo files so they are usable by zope. This automatic compiling
does not happen .po files in packages. So it is better to compile
those files yourself. You can do that like this: