Localization management
Helium localization management turns browser UI text from the patch set into a shared source catalog and translated language assets. The workflow keeps those assets aligned with Chromium's language files, protects placeholders and markup, and gives language owners a clear review path.
Localization model
Source catalog
The source catalog is the set of English UI messages that Helium adds or changes through its Chromium patches. It also includes the onboarding string set. The generated catalog records each message's identifier, source file, context, optional meaning, and English text in i18n/source.gen.json.
The catalog is the common input for translation, cleanup, linting, and application to a Chromium source tree. It is generated from the patch series and platform repositories, so engineers should change the source patch or string definition rather than edit the catalog by hand. i18n/README.md devutils/i18n_generate.py
References: i18n/source.gen.json• L1-20 devutils/i18n_generate.py• L139-164 i18n/README.md• L38-44
Language assets
Helium keeps one JSON translation file for each locale named in i18n/languages.json. Each entry stores the stable message name, the English source text, and the translated message. Optional feminine and masculine forms support languages where a UI phrase changes with the user's grammatical gender.
The language list follows the languages already supported by Chromium. i18n/owners.yml adds optional reviewers for individual locale files. This separates the supported-language contract from the people who review changes to a language.
References: i18n/languages.json• L1-82 i18n/README.md• L46-62 i18n/owners.yml• L1-95
Translation identity
The workflow matches a translation by the pair of its message name and English source text. This lets entries move within a file without changing their meaning, while a changed English message becomes a new translation task.
The application step uses the full source metadata to compute the Chromium message fingerprint. The context and optional meaning therefore remain important even though they are not copied into each translation entry. Placeholder tags and their names are part of the message contract.
References: devutils/i18n_translate.py• L107-133 utils/i18n_apply.py• L28-35 utils/i18n_apply.py• L143-160
Localization lifecycle
Source extraction
Source extraction collects translatable messages from GRD and GRDP changes listed by the main and platform patch series. It also reads the onboarding repository at the version selected by the repository's dependency settings. The result is a reproducible English catalog for the current Helium patch set.
The extraction command updates platform repository checkouts before it reads them. It includes only added or changed message content from patch hunks, which prevents untouched upstream text from becoming Helium translation work.
This diagram shows how patched source definitions become the catalog used by all later localization stages.
flowchart LR
A[Patch series] --> C[GRD and GRDP message changes]
B[Platform repositories] --> C
C --> D[Generated English source catalog]
D --> E[Translation files]
E --> F[Chromium XTB language assets]
References: devutils/i18n.py• L21-35 devutils/i18n_generate.py• L33-75 devutils/i18n_generate.py• L77-151
Translation generation
Translation generation compares the source catalog with the selected locale file. It sends only missing or changed messages for translation, while nearby existing messages can provide style context without becoming new work.
The normal backend is a chat-completions service. A command backend or a saved JSON response can be used when a different review or translation process is required. The prompt defines the language, UI tone, brand rules, browser terms, shortcut rules, gender variants, and ICU plural syntax.
The command can update one or more named locales. An all-language run uses the complete language map, while importing a saved response requires a selected locale so the result has a clear destination.
References: devutils/i18n_translate.py• L121-189 devutils/i18n_translate.py• L192-228 devutils/i18n_translate.py• L298-355 i18n/prompt.md• L1-33
Existing translation recovery
The forage workflow recovers usable translations that already exist in an upstream Chromium checkout. It maps each Helium source message to its Chromium XTB file, compares the Chromium message fingerprint, and adds exact matches to the relevant Helium locale file.
This workflow reduces duplicate translation work. It does not replace normal translation generation because it only fills entries for which an upstream XTB message has the same fingerprint.
References: devutils/i18n_forage.py• L21-38 devutils/i18n_forage.py• L41-69 devutils/i18n_forage.py• L95-111
Translation cleanup
Cleanup removes locale entries whose English source is no longer in the current catalog. It also keeps only the first entry for a repeated message identity. This keeps old UI text and duplicate records from surviving after source patches change.
Cleanup acts on every locale named by the language map. It changes a file only when it removes an entry, so an up-to-date locale remains stable.
References: devutils/i18n_clean.py• L14-36 devutils/i18n_clean.py• L39-53
Translation linting
Linting checks that each locale message is valid XML, points to a current source message, and preserves the source placeholders. It checks placeholders both in the stored translation and after conversion to the XTB form, which protects the final Chromium asset as well as the JSON input.
The lint does not decide whether a translation is natural or complete for every locale. Language owners provide that human review, while the automated check protects the structural contract.
References: devutils/i18n_lint.py• L20-41 devutils/i18n_lint.py• L44-81 i18n/README.md• L20-29
Chromium asset application
Application moves approved JSON translations into the Chromium XTB files used by the browser. It resolves the parent GRD for each source file, finds the locale-specific XTB path, computes the Chromium message ID, and inserts or updates the matching translation element.
The operation applies all listed locales to a supplied Chromium source tree. A missing locale XTB file is a hard error because silently skipping it would leave the browser with incomplete coverage. Norwegian Bokmål uses Chromium's no XTB code even though Helium names the locale nb.
References: utils/i18n_apply.py• L38-70 utils/i18n_apply.py• L119-140 utils/i18n_apply.py• L164-209
Review and quality gates
Translation review
Translation changes use locale files as the review unit. The translation notification workflow watches changes under i18n/translations/, maps changed locale filenames to the reviewers in i18n/owners.yml, and posts one review request on the pull request.
The notification is skipped for fork pull requests and for pull requests that opt out or already have a review request. The project guidance asks contributors to correct existing strings through normal pull requests, while new translation batches remain maintainer-managed. See GitHub workflow automation for the wider pull request automation model.
References: .github/…/i18n-notify.yml• L1-45 .github/…/i18n_notify.py• L11-29 i18n/README.md• L12-18
Continuous checks
The i18n CI job regenerates the source catalog and compares it with the committed file. It then runs the translation lint. Together these checks catch source drift and broken translation structure before the change reaches a build.
The localization checks are one part of the repository's broader developer quality checks. See developer quality tooling for the surrounding validation model.
References: .github/…/lint.yml• L18-33 devutils/i18n.py• L68-88 devutils/i18n_lint.py• L44-81
Change checklist
When these files or sections are changed, remember to consider these:
- When a GRD or GRDP message changes in a patch, regenerate i18n/source.gen.json before translation files are reviewed.
- When a locale code changes in i18n/languages.json, check its translation file, Chromium XTB language mapping, and any matching entry in i18n/owners.yml.
- When message context, meaning, or placeholder names change, verify the resulting Chromium message ID and all translations that depend on it.
- When translation JSON identity fields change, keep the
nameplus English source-text contract aligned with the source catalog. - When the translation prompt changes, review plural branches, placeholder handling, brand terms, and the expected response fields together.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The committed source catalog does not match extraction output | New or changed UI text has no reliable translation input | The i18n CI job regenerates the catalog and fails on drift |
| A translation contains invalid XML or changes a placeholder | Chromium cannot safely consume the message or may bind a value incorrectly | devutils/i18n_lint.py parses the message and checks placeholders before and after XTB conversion |
| A translation points to an old English source message | The entry is ignored during application and the UI falls back to another language or source text | Run cleanup after source changes and run the translation lint |
| A locale has no matching XTB file in the Chromium tree | Application stops instead of reporting full language coverage | Keep locale codes aligned with Chromium's GRD language mapping; check the special nb to no mapping |
| A translation response omits a requested message or adds invalid fields | The locale file is not safely updated | The response parser requires the expected names and allowed fields |
Key files
| File | Why to read it |
|---|---|
| i18n/README.md | States the asset format, contribution policy, review focus, and main development commands. |
| i18n/source.gen.json | Shows the generated source-message contract and the metadata carried into translation and application. |
| i18n/languages.json | Defines the supported locale codes and their display names. |
i18n/translations/ | Holds the per-locale translated messages reviewed by language owners. |
| i18n/prompt.md | Defines the translation rules for placeholders, browser terms, plural syntax, and output shape. |
| devutils/i18n.py | Provides the single command entry point for generation, translation, cleanup, and upstream recovery. |
| devutils/i18n_generate.py | Explains how patch and onboarding message sources become the generated catalog. |
| devutils/i18n_translate.py | Explains how missing or changed messages become locale entries. |
| devutils/i18n_clean.py | Defines removal of stale and duplicate locale entries. |
| devutils/i18n_lint.py | Defines the structural and placeholder checks for translation files. |
| utils/i18n_apply.py | Connects Helium translation entries to Chromium XTB assets. |
| .github/…/lint.yml | Shows the source-drift and translation-lint gates in CI. |
| .github/…/i18n-notify.yml | Shows when locale owners receive automated review requests. |