Customize Plone translations with iw.recipe.cmd

Posted on Fri 17 July 2009 in Plone

Sometimes the good translations of Plone do not fit your usecase or screen space. Overriding the translations in a pre-buildout area was easy. All you needed to do is to put a directory i18n in your instance home containing a file custom-plone-en.po. The structure of the filename is important: custom-DOMAIN-LANGUAGECODE.po

Nowadays all people use buildouts and adding something to the instance doesn't seem to be a good idea. It lives in the parts directory and gets overridden on every "install" run of buildout. A solution I use (on Linux) is to maintain the translations in a directory i18n in the buildout and let a recipe copy it to the instance.

For the recipe I use iw.recipe.cmd and the buildout snippet looks like this:

[i18n]
recipe = iw.recipe.cmd
on_install = true
on_update = true
cmds = test -d ${instance:location}/i18n && rm -rf ${instance:location}/i18n || true cp -R ${buildout:directory}/i18n ${instance:location}/

Update! 27.08.2010This Recipe only works with Plone 3. For Plone 4 and onwards it is not need any longer. The Plone i18n-domain can be overridden in a customization product.