I18n help with plone pattern strings

I have at least one piece of code where I have used plone i18n tools to retranslate English to English - a client wanted the plone.app.checkflow status message to say "Published" instead of "Checked In". I am trying to do so again for a description field that is part of the pat-tinymce pattern, but an unable to see the results. My guess is that I am missing some extra step needed for js, or that it just won't work here.

My package has locales/en/LC_MESSAGES/plone.po and this file contains pairs of msgid and msgstr. In the root configure.zcml I have <i18n:registerTranslations directory="locales"/>. In my zope.conf I have <environment>zope_i18n_compile_mo_files True</environment> which looks like it creates the plone.mo file on start up. I looked into i18ndude but if I understand it correctly, this is just to assist in finding po files and generating the mo files so I don't think I need it with that zope.conf setting?

As a sanity check I also put this in my plone.po

msgid "label_edit_default_view_container"
msgstr "foobar"

That works. It just doesn't work for the js string I want to change:

#: pat/tinymce/tinymce.js#: pat/tinymce/tinymce.js
msgid "External URL (can be relative within this site or absolute if it starts with http:// or https://)"
msgstr "foobar"

JS translations are usually done in widgets.po ... see this thread for how to override it Overriding plone.app.locales - #5 by ksuess ... make sure you clean your browsers localstorage.

Interesting. I changed it to widgets.po, but I noticed that there was nothing in local storage. I decided to try copying the en folder to the more specific en_US (the site is on en-us). This time I do see it pulled into local storage

But as you can see, it still did not work. However, if I save the page and re-edit (I did NOT restart Plone), I am able to see the change. So that was another caching gotcha I guess.

I am confused why I needed to do en_US here. All of my plone.po translations work for just en

My experiences:

  • widget translation machinery reads the current language from the <html lang="xx"> tag and the catalog url from <body data-i18ncatalogurl="xx"> (see mockup/src/core/i18n.js at master · plone/mockup · GitHub) maybe you can check, what language is rendered there (I assume this comes from the global site language settings)
  • if you've cleared the localstorage, the translation is there after the second reload ... I have seen this several times but I didn't have time to look into this yet ...

It is as you stated, "en_US" there. I guess the other Plone translation machinery is using something slightly different?