From 06001494dcbfdabf3b3e952bb6b467c4e43575ea Mon Sep 17 00:00:00 2001 From: Giulia Ghisini <51911425+giuliaghisini@users.noreply.github.com> Date: Thu, 24 Aug 2023 17:37:15 +0200 Subject: [PATCH 01/22] Fix load addon translations: last addon translations wins (#5113) Co-authored-by: Steve Piercy Co-authored-by: David Glick --- docs/source/addons/i18n.md | 5 ++++- news/5113.bugfix | 1 + packages/scripts/i18n.cjs | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 news/5113.bugfix diff --git a/docs/source/addons/i18n.md b/docs/source/addons/i18n.md index 2785521f86..8e904fd5aa 100644 --- a/docs/source/addons/i18n.md +++ b/docs/source/addons/i18n.md @@ -31,4 +31,7 @@ In the context of your project, run `yarn i18n` to merge the add-on translations ## Override translations -The workflow allows you to override translations from your project scope, so the project translations "always win". +If you have multiple add-ons installed in your project, the translations are loaded in the order your add-ons are listed in `package.json`. +If two add-ons provide different translations for the same message, then the last defined add-on wins. + +When running `yarn i18n` in the context of your project, the project's own locales are processed last and can override translations from any add-on. diff --git a/news/5113.bugfix b/news/5113.bugfix new file mode 100644 index 0000000000..de7f230030 --- /dev/null +++ b/news/5113.bugfix @@ -0,0 +1 @@ +Fix load addon translations: last addon translations wins @giuliaghisini diff --git a/packages/scripts/i18n.cjs b/packages/scripts/i18n.cjs index b1023c4538..d3088bac5f 100755 --- a/packages/scripts/i18n.cjs +++ b/packages/scripts/i18n.cjs @@ -186,8 +186,8 @@ function poToJson({ registry, addonMode }) { const addonItems = Pofile.parse( fs.readFileSync(addonlocale, 'utf8'), ).items; - items = [...addonItems, ...items]; - mergeMessages(result, items, lang); + + mergeMessages(result, addonItems, lang); if (require.main === module) { // We only log it if called as script console.log(`Merging ${addon} locales for ${lang}`); From 54d5119d8d8a2f28aff963ae2bc07a34834fa543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Thu, 24 Aug 2023 17:37:34 +0200 Subject: [PATCH 02/22] [Visual bugfix] Match the original mockups for PastanagaUI in regards of the error messages in form field elements (#5115) --- news/5115.bugfix | 1 + .../manage/Widgets/FormFieldWrapper.jsx | 2 +- .../__snapshots__/IdWidget.test.jsx.snap | 4 +- .../pastanaga/collections/form.overrides | 46 +++++++++++++++++++ .../themes/pastanaga/elements/input.overrides | 6 +++ .../themes/pastanaga/elements/label.overrides | 10 ++++ 6 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 news/5115.bugfix diff --git a/news/5115.bugfix b/news/5115.bugfix new file mode 100644 index 0000000000..b47d2642cc --- /dev/null +++ b/news/5115.bugfix @@ -0,0 +1 @@ +[Visual bugfix] Match the original mockups for PastanagaUI in regards of the error messages in form field elements @sneridagh diff --git a/src/components/manage/Widgets/FormFieldWrapper.jsx b/src/components/manage/Widgets/FormFieldWrapper.jsx index 542dc0cd0f..5406ffbfcd 100644 --- a/src/components/manage/Widgets/FormFieldWrapper.jsx +++ b/src/components/manage/Widgets/FormFieldWrapper.jsx @@ -96,7 +96,7 @@ class FormFieldWrapper extends Component { {this.props.children} {map(error, (message) => ( -