Plone, internally (plone.app.multilingual, GenericSetup), uses the <language>-<lowercase two-letter country code> format. It also stores the value on
the language field of Dexterity content items.
On the other hand, locales use the <language>_<uppercase two-letter country code>.
plone.api support
plone.api.portal.translate uses the localesformat, which requires the developer to first manually convert frompt-brtopt_BR` to get the correct translation.
Background
Plone, internally (plone.app.multilingual, GenericSetup), uses the
<language>-<lowercase two-letter country code>
format. It also stores the value on the language field of Dexterity content items. On the other hand, locales use the<language>_<uppercase two-letter country code>
.plone.api support
plone.api.portal.translate
uses the localesformat, which requires the developer to first manually convert from
pt-brto
pt_BR` to get the correct translation.Example code
Suggested fix
In
plone.api.portal.translate
, detect if the language code uses the plone.app.multilingual|GenericSetup format and convert it to the locales format.