Skip to content

Add a script to propagate English translations to all locales - #4217

Merged
Kocal merged 1 commit into
symfony:3.xfrom
Kocal:sync-translations-script
Nov 6, 2026
Merged

Kocal merged 1 commit into
symfony:3.xfrom
Kocal:sync-translations-script

Conversation

@Kocal

@Kocal Kocal commented Nov 6, 2026 •

Copy link
Copy Markdown
Member
Q A
Bug fix? no
New feature? no
Deprecations? no
Documentation? no
Issues
License MIT

This PR adds .github/sync-translations.php, adapted from the script of the same name in symfony/symfony. It copies every unit of each package's <domain>.en.xlf into all the other locales of that package, and a unit a locale is missing gets the English source as its target with state="needs-translation".

It needs symfony/translation and symfony/config, now in the root require-dev. The workflow is the one symfony/symfony uses: run the script after adding an English message, machine-translate the new targets, then mark them state="needs-review-translation" so the translation checker bot opens one issue per language for native speakers.

Unlike the symfony/symfony script, this one flags only absent units, because flagging a target equal to its source would wrongly flag the French Pagination unit Pagination.

@Kocal
Kocal force-pushed the sync-translations-script branch from c6908de to 9c39ac4 Compare November 6, 2026 16:01
@Kocal Kocal changed the title sync translations script Add a script to propagate English translations to all locales Nov 6, 2026
@Kocal
Kocal marked this pull request as ready for review November 6, 2026 21:16
@Kocal
Kocal force-pushed the sync-translations-script branch from 9c39ac4 to 667a7df Compare November 6, 2026 21:16
@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Nov 6, 2026
| Q              | A
| -------------- | ---
| Bug fix?       | no
| New feature?   | no
| Deprecations?  | no
| Documentation? | no
| Issues         |
| License        | MIT

This PR adds `.github/sync-translations.php`, adapted from the script of the same name in symfony/symfony. It copies every unit of each package's `<domain>.en.xlf` into all the other locales of that package, and a unit a locale is missing gets the English source as its target with `state="needs-translation"`.

It needs `symfony/translation` and `symfony/config`, now in the root `require-dev`. The workflow is the one symfony/symfony uses: run the script after adding an English message, machine-translate the new targets, then mark them `state="needs-review-translation"` so the translation checker bot opens one issue per language for native speakers.

Unlike the symfony/symfony script, this one flags only absent units, because flagging a target equal to its source would wrongly flag the French Pagination unit `Pagination`.
@Kocal
Kocal force-pushed the sync-translations-script branch from 667a7df to 5d66cd0 Compare November 6, 2026 21:26
Kocal added a commit that referenced this pull request Nov 6, 2026
| Q              | A
| -------------- | ---
| Bug fix?       | no
| New feature?   | no
| Deprecations?  | no
| Documentation? | no
| Issues         |
| License        | MIT

22 Autocomplete locales were missing the `Add %placeholder%...` message. They now have a machine translation marked `state="needs-review-translation"`, as symfony/symfony does for its components.

Once symfony-tools/symfony-translation-checker supports Symfony UX, it will open one issue per language asking a native speaker to review these translations. The units were added with the `.github/sync-translations.php` script from #4217.

`sr_RS` uses the Latin script, like two of its three existing messages (the third is in Cyrillic). A Serbian reviewer should pick one.
Kocal added a commit that referenced this pull request Nov 6, 2026
This PR was merged into the 3.x branch.

Discussion
----------

[Autocomplete] Provide missing translations

| Q              | A
| -------------- | ---
| Bug fix?       | no
| New feature?   | no
| Deprecations?  | no
| Documentation? | no
| Issues         |
| License        | MIT

22 Autocomplete locales were missing the `Add %placeholder%...` message. They now have a machine translation marked `state="needs-review-translation"`, as symfony/symfony does for its components.

Once symfony-tools/symfony-translation-checker supports Symfony UX, it will open one issue per language asking a native speaker to review these translations. The units were added with the `.github/sync-translations.php` script from #4217.

`sr_RS` uses the Latin script, like two of its three existing messages (the third is in Cyrillic). A Serbian reviewer should pick one.

Commits
-------

f33982e [Autocomplete] Provide missing translations
@Kocal
Kocal merged commit bf460fe into symfony:3.x Nov 6, 2026
36 checks passed
@Kocal
Kocal deleted the sync-translations-script branch November 6, 2026 21:42
Kocal added a commit that referenced this pull request Nov 6, 2026
| Q              | A
| -------------- | ---
| Bug fix?       | no
| New feature?   | no
| Deprecations?  | no
| Documentation? | no
| Issues         |
| License        | MIT

The "Code Quality" job now runs `.github/sync-translations.php` (added in #4217) and fails if a catalogue under `src/*/translations/` changes. It prints the diff to apply, like the check the job already does for `.github/sync-packages.php`.

A PR that adds an English message without adding it to the other locales now fails. The author runs the script, then either machine-translates the new targets with `state="needs-review-translation"` or leaves them in `needs-translation`.

Both states are reported to native speakers by symfony-tools/symfony-translation-checker. This replaces extending the checker's automated sync PR to symfony/ux, which would need a carsonbot fork of symfony/ux.
Kocal added a commit that referenced this pull request Nov 6, 2026
This PR was merged into the 3.x branch.

Discussion
----------

Check that translations are in sync in CI

| Q              | A
| -------------- | ---
| Bug fix?       | no
| New feature?   | no
| Deprecations?  | no
| Documentation? | no
| Issues         |
| License        | MIT

The "Code Quality" job now runs `.github/sync-translations.php` (added in #4217) and fails if a catalogue under `src/*/translations/` changes. It prints the diff to apply, like the check the job already does for `.github/sync-packages.php`.

A PR that adds an English message without adding it to the other locales now fails. The author runs the script, then either machine-translates the new targets with `state="needs-review-translation"` or leaves them in `needs-translation`.

Both states are reported to native speakers by symfony-tools/symfony-translation-checker. This replaces extending the checker's automated sync PR to symfony/ux, which would need a carsonbot fork of symfony/ux.

Commits
-------

44378dc Check that translations are in sync in CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Needs Review Needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants