plone / volto

React-based frontend for the Plone Content Management System
https://demo.plone.org/
MIT License
446 stars 606 forks source link

i18n mechanism discards translations when msgid is changed #6159

Open ichim-david opened 2 months ago

ichim-david commented 2 months ago

In https://github.com/plone/volto/pull/6109 we had a typo in the default message and msgId since we usually set it to the same value. https://github.com/plone/volto/pull/6109/files#diff-08caa52065300f9f9f50990bdc26ff5628638fe5a7bd0337a187a4c7d739c9a4L159

Because of this when pnpm i18n runs and the msgid changes, it discards any translation added for that msgid as seen in this screenshot i18n-translations

I had to add commit https://github.com/plone/volto/pull/6109/commits/1d501fd8d51461994c8134469d57d5f9a97a4848 in order to manually insert the values back so that we wouldn't lose these translations.

I don't know if we can make the engine smarter, or if we could use another strategy for msgid to be different from the default message making it perhaps less brittle to the actual message, leaving this issue open to discussion if we can do anything to improve this workflow.