Overriding plone.app.locales

Hello there,

What is the canonical way (if there is any) of overriding some entries for translations in plone.app.locales?

I have a policy package, with a locales folder, and I tried to add an updated plonelocales.po there, but it seems the version on plone.app.locales always wins.

Ensure your package is loaded in zcml before plone.app.locales:

  1. in your configure.zcml load your policies locales as first: <i18n:registerTranslations directory="locales" />
  2. in buildout.cfg instance eggs and esp. in zcml section your package is the only or at least first one (esp. no Plone/Products.CMFPlone)
  3. try to avoid z3c.autoinlcude features
1 Like

See alternative instructions here:

You can add a locales folder in your buildout folder
There you place po files with same name as the file you want overwrite

1 Like

After doing that, you may need to add the following line in your configure.zcml just after the i18n:registerTranslations directive:

<include package="Products.CMFPlone" />

We were just biten by this.

2 Likes

To override the image type names in TinyMCE image insert dialog I

  • added a locales folder in buildout directory
  • added widgets.po with domain 'widgets' (copy of original widgets.po with msgids removed but the ones we need
  • <include package="Products.CMFPlone" />

No effect. As it is part of the TinyMCE stuff. Do I need to recompile resources? Or what do I miss?

Two things:

  • In a locales dir in buildout you still need the proper structure. I just saw a project with a file locales/plone.po which did not work. In your case for English it would need to be: locales/en/LC_MESSAGES/widgets.po.
  • Since this is TinyMCE, these translations may come from javascript. These translations are cached in the browser for a day, in localStorage. So open the developer tools of your browser, check if widgets-en is in localStorage and remove it.
1 Like

Removing widget-de from LocalStorage helped to see the modified translation. Thank you @maurits!

Plone Foundation Code of Conduct