Skip to content

Own the English translation files in-repo - #593

Merged
sandhose merged 2 commits into
mainfrom
quenting/i18n-english
Sep 2, 2026
Merged

Own the English translation files in-repo#593
sandhose merged 2 commits into
mainfrom
quenting/i18n-english

Conversation

@sandhose

@sandhose sandhose commented Aug 24, 2026

Copy link
Copy Markdown
Member

Production builds strip defaultMessage, so new or reworded English copy only renders once translations/compiled/en.json contains it — and that file was only ever written by the Localazy download workflow, meaning English changes shipped as raw message IDs until the next translations download.

English never needed that roundtrip: translated/en.json is derivable from the extracted file. This derives it locally (scripts/i18n-sync-en.mjs), chains pnpm i18n:extract so one command regenerates all three English files, stops downloading the source language from Localazy, and adds a CI check that fails when the committed files drift from the source.

The second commit is the first beneficiary: four list pages wrote their zero-count heading as zero {No users}, a CLDR plural category English doesn't have, so empty lists read "0 users". Other locales get the fix through Localazy.

@sandhose
sandhose force-pushed the quenting/i18n-english branch from 6072049 to 13352f5 Compare August 24, 2026 08:08
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 24, 2026

Copy link
Copy Markdown

Deploying admin-beta-element-dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5c7ec31
Status: ✅  Deploy successful!
Preview URL: https://35cf2b87.admin-beta-element-dev.pages.dev
Branch Preview URL: https://quenting-i18n-english.admin-beta-element-dev.pages.dev

View logs

@sandhose
sandhose force-pushed the quenting/i18n-english branch 2 times, most recently from 83fa8be to 0c4d580 Compare August 25, 2026 10:26
@sandhose
sandhose marked this pull request as ready for review August 25, 2026 11:00
Production builds strip defaultMessage, so a new or reworded English
string only renders once translations/compiled/en.json contains it — and
until now that file was only ever written by the Localazy download
workflow. A PR changing English copy therefore shipped raw message IDs
until the next translations download landed, and the Playwright suite
(which runs against a production build) could not assert on the new copy
in the same PR.

English never needed the roundtrip: translations/translated/en.json as
downloaded from Localazy is byte-for-byte the extracted file minus the
descriptions. Derive it locally instead (scripts/i18n-sync-en.mjs), chain
i18n:compile onto pnpm i18n:extract so one command regenerates all three
English files, and stop downloading the source language from Localazy.
The other locales are untouched: they still come from Localazy through
the download workflow's automated PRs.

CI now checks that the committed translation files match the source, so
they can no longer drift from the code. That also re-syncs the extracted
file here: the dependency bump in bbe747b changed the field order
@formatjs/cli emits within each entry (message and description swapped),
and the file had not been regenerated since.
/users, /rooms, /federation/known-domains and /registration-tokens wrote
their zero-item plural arm as `zero {No users}`, which never fires: `zero`
is a CLDR plural category and English has no zero category, so
Intl.PluralRules picks `other` and the heading read "0 users". The other
four list pages already used the exact-match `=0` form.

Fixed in the four route sources, with the English translation files
regenerated. The other locales carry the same dead `zero` arm; that is
harmless (the arm is never selected in any of them) and Localazy owns
those files, so it gets fixed there and arrives with a future
translations download.
@sandhose
sandhose force-pushed the quenting/i18n-english branch from 0c4d580 to 5c7ec31 Compare September 2, 2026 08:25
@sandhose
sandhose merged commit d98f267 into main Sep 2, 2026
6 checks passed
@sandhose
sandhose deleted the quenting/i18n-english branch September 2, 2026 08:36
@sandhose sandhose added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant