Vous êtes ici : Accueil Articles My translation doesn't show up in Plone 4

My translation doesn't show up in Plone 4

I explain what changed in Plone 4 regarding the po compilation.

I see people complaining about translation that is not working in Plone 4.

In Plone 4, PlacelessTranslationService now uses zope.i18n. The i18n and locales directories use the same catalog engine.

In Plone 3, PlacelessTranslatiService took care of compiling the po files. But in Plone 4 it is not the case anymore.

If you want the same behavior, you can give an option to zope.i18n like this in your buildout.cfg:

[instance]
# ...
environment-vars =
    zope_i18n_compile_mo_files true

I updated ZopeSkel to include this option when you create a buildout for Plone 4. The change will be in ZopeSkel 2.17.

If you didn't know, to create a Plone 4 buildout, you use the plone3_buildout template. If you give a version beginning with a 4 (4.0b1-1 for example), you have something completely different than a Plone 3 buildout.

And if you wonder why when you don't have the option enabled, Plone translations show up but not the third party one. Well it's simple, I include the mo files in the plone.app.locales package when I release it.

It's not a good idea to have mo files subversioned, but having mo files in the archive (if you compile them just before releasing the package) can resolve here some permission issues. For example the user starting the Plone instance may not have the permission to write to the package directory.

Actions sur le document

Good work!

Posté par http://stevemcmahon.myopenid.com/ le 25/03/2010 19:00

Thanks for explaining this change.

It's always been a bad idea for the daemon process to be writing files into the code space, and this makes it much easier to handle the file permissions for more secure installs.

Day 2 trying to get this translation thing to work

Posté par http://pigeonflight.myopenid.com/ le 25/06/2010 12:46

Your tip helped me except that I left out the extra equal sign (=).

[instance] #... environment-vars = zope_i18n_compile_mo_files true

never tried it with the equal sign so I don't know if it works with it, though I doubt it.

What about add-ons?

Posté par http://keul.myopenid.com/ le 23/08/2011 14:53

All this is ok for default plone translations.

As I can understand this environment variable must be set for development purpose.

Commonly no add-on products put .mo files on SVN or in the package. You suggest to start versioning and distributing .mo files also like Plone does?