Skip to content

Remove messages entries that are only ever served by another domain - #3773

Open
Vondry wants to merge 1 commit into
bolt:6.1from
Vondry:fix/remove-wrong-domain-duplicates
Open

Remove messages entries that are only ever served by another domain#3773
Vondry wants to merge 1 commit into
bolt:6.1from
Vondry:fix/remove-wrong-domain-duplicates

Conversation

@Vondry

@Vondry Vondry commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Third of the PRs splitting up #3753. Independent of the others—it branches from master and touches only the messages catalogues.

This is a pure cleanup with no behavioural impact: 24 unreachable translation units are removed, with no lookup changes and no translated wording altered.

The four keys

Each of these keys exists in the messages domain but is only ever resolved from a different translation domain:

Key Used at Resolved in
user.not_valid_display_name src/Entity/User.php:35,36 (Assert\NotBlank, Assert\Length) validators
user.not_valid_email src/Entity/User.php:49 (Assert\Email) validators
user.not_valid_password src/Entity/User.php:57 (Assert\Length) validators
You have to login in order to access this page. src/Security/AuthenticationEntryPointRedirector.php:26 (trans(..., 'security')) security

These five call sites are the only occurrences anywhere in the repository, including vendor/. Nothing resolves these keys from the messages domain, and debug:translation --domain=messages reports all four as unused.

Why the messages copies cannot matter

validator.translation_domain is configured as validators (verified with debug:container and not overridden in framework.yaml), and ExecutionContext:145 translates every validation message in that domain.

Symfony's Translator supports fallback locales, but not fallback domains. A lookup in the validators domain can never fall back to messages.

These entries are therefore unreachable by construction, not merely unused.

What is removed (and what is not)

Entries are removed only where the same locale already contains the key in the domain that actually serves it.

Locale Removed Left in place
cs, en, ru 4 each
el, tr, uk 3 each
fr 3 You have to login…
hu 2
nl 3
zh_CN 3

24 translation units are removed across 7 files; 9 are intentionally retained.

The remaining entries correspond to locales where the serving domain does not yet contain the translation (security.fr, security.nl, validators.hu, validators.nl, and validators.zh_CN). Those locales currently fall back to English.

Although the duplicate entries in messages are equally unreachable, deleting them would discard translated text that should instead be moved into the correct domain. That would change runtime behaviour and is therefore left for a separate PR.

Four keys are duplicated into the messages catalogue but are only ever
looked up in a different domain:

  user.not_valid_display_name   src/Entity/User.php:35,36
  user.not_valid_email          src/Entity/User.php:49
  user.not_valid_password       src/Entity/User.php:57
      Assert constraint messages, which Symfony resolves in `validators`

  You have to login in order to access this page.
      src/Security/AuthenticationEntryPointRedirector.php:26,
      trans(..., 'security')

Nothing reads them from `messages`, so the entries are unreachable and
`debug:translation --domain=messages` reports all four as unused.

Removes 24 units from 7 catalogues - only where that same locale already
carries the key in the domain that serves it, so no lookup changes result.

Nine entries are deliberately left in place: security.fr, security.nl,
validators.hu, validators.nl and validators.zh_CN have no entry for their
key, so those locales fall back to English today. Deleting the messages
copy would be equally unreachable but would discard translated text that
should instead be moved into the correct domain. That move belongs in its
own change.
@Vondry
Vondry force-pushed the fix/remove-wrong-domain-duplicates branch from 317c0d2 to 75a87e8 Compare August 3, 2026 15:44

@bobvandevijver bobvandevijver left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking, this is classified as a breaking change. We do not know what our consumers are using, and that could result in them no longer having a translation.

For this change, we will need to target 6.2, and add a note to the upgrade notes (which translations have been removed).

By targeting the 6.2 branch, the translations that were kept because they need to be removed can then also be done in the same (this) PR.

@bobvandevijver

Copy link
Copy Markdown
Member

By the way, I've just update 6.2 so that the latest translation updates for 6.1 are available there now as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants