Fix duplicate react-intl message ids breaking yarn build-locales - #7283
Open
jaroslav-kubicek wants to merge 4 commits into
Open
Fix duplicate react-intl message ids breaking yarn build-locales#7283jaroslav-kubicek wants to merge 4 commits into
jaroslav-kubicek wants to merge 4 commits into
Conversation
combine-react-intl-messages throws on any message id defined in more
than one src/**/messages.js file, which broke yarn build-locales on
develop (first hit: management.button.cancel). Deduplicate all 11 ids:
- levels/messages.js and badges/messages.js re-export the messages
they shared with teamsAndOrgs/messages.js (cancel, save, name,
manage, badges, levels, add, description, image) instead of
re-declaring them, keeping the existing Transifex ids intact.
- projectEdit database labels get their own management.projects.edit.*
ids; they collided with projectCreate ids while carrying different
English texts, and were added after en.json was last regenerated so
no translations exist for them yet.
- taskSelection sandbox info box gets project.detail.sandbox.info,
resolving the conflict with projectDetail's project.detail.sandbox
("Sandbox Mode" vs "Sandbox(Practice)").
- header/messages.js drops its unused sandbox message, dead since the
badge moved to the project detail header.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Output of yarn build-locales, which was blocked by the duplicate ids since mid-2025; the last regeneration was in June 2025, so this picks up a year of accumulated message additions, rewordings and removals. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The tool exits non-zero on any duplicate react-intl message id, so this makes duplicates fail the PR instead of silently breaking locale regeneration, which nothing in CI previously exercised. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
|
Collaborator
|
Nice fix for the yarn build-locales failure reusing the canonical descriptors, renaming the conflicts, and regenerating the catalog all makes sense. Two things before I approve:
Also, no issue at all with using AI to help write this, that's normal. Just noticed a couple commits have a Claude co-author trailer; could you drop that? Just want authorship on the repo to stay clean regardless of what tools were used. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #7284
What
yarn build-localesfails ondevelopwithError: Duplicate message id: management.button.cancel, sofrontend/src/locales/en.jsoncould not be regenerated since June 2025 — no string added since then has reached Transifex. The reported id is only the first duplicate the tool hits; a full audit found 11 duplicated ids. This PR deduplicates all of them, regeneratesen.json, and adds a CI step so this class of breakage fails PRs in the future.Changes
Identical duplicates (translations preserved).
levels/messages.jsandbadges/messages.jsre-declared nine ids thatteamsAndOrgs/messages.jshas defined since 2019 (management.button.cancel,.save,management.fields.name,.description,.managers.add,.organisation.image,management.link.manage,management.badges,management.levels). They now import and re-export the canonical definitions — same runtime keys, zero component changes, existing Transifex ids and translations untouched.Conflicting duplicates (new ids, no translation loss). Two clusters shared an id with different English texts, so one text silently won depending on extraction order:
projectEdit/messages.jsvsprojectCreate/messages.js:management.projects.create.review.database+.osm+.sandbox("Database"/"OSM"/"Sandbox" vs "Where should edits be saved?"/"OpenStreetMap (Live)"/"Training Sandbox (Practice)"). The projectEdit entries now usemanagement.projects.edit.database*.taskSelection/messages.jsvsprojectDetail/messages.js:project.detail.sandbox("Sandbox(Practice)" vs "Sandbox Mode"). The taskSelection entry now usesproject.detail.sandbox.info.All four renamed ids were added after the last successful en.json regeneration, so they never reached Transifex — no translations are lost. The unused
sandboxmessage inheader/messages.js(dead since #7278 moved the badge to the project detail header) is removed.Regenerated
en.json. ~140 additions are a year of accumulated new messages; the few removals/rewordings all correspond to messages actually deleted or changed in source since June 2025. After merge, a maintainer needs to runtx push -sso these strings finally reach translators.CI guard.
pr_test_frontend.ymlnow runsyarn build-localesafter install; the tool exits non-zero on any duplicate id, so future duplicates fail the PR instead of breaking locale regeneration unnoticed. (The contributing guidelines already require regenerating en.json with string changes — this was just unenforced.)