Skip to content

Remove four keys from the messages domain, moving remaining translations to validators/security - #3773

Open
Vondry wants to merge 3 commits into
bolt:6.2from
Vondry:fix/remove-wrong-domain-duplicates
Open

Remove four keys from the messages domain, moving remaining translations to validators/security#3773
Vondry wants to merge 3 commits into
bolt:6.2from
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. Targets 6.2, and touches the messages, validators and security catalogues.

Four keys exist in the messages domain but are only ever resolved from a different domain. This PR removes them from messages entirely, moving the translations that only existed there into the domain that actually serves them.

As discussed, this is classified as a breaking change for consumers who translate these keys from the messages domain themselves, so it targets 6.2 and adds an entry to UPGRADING.md.

The four keys

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/.

Why the messages copies cannot matter

validator.translation_domain is configured as validators (verified against the live container; 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 validators can never fall back to messages. These entries are unreachable by construction, not merely unused.

Commit 1 — remove duplicates (no behavioural impact)

28 units removed across 8 locales (cs, el, en, fr, ru, sk, tr, uk), in every case where the serving domain already held the same key.

Verified by resolving all four keys through the real translator for every locale, before and after: output is byte-identical. Worth noting that 10 of the 28 had drifted from the serving copy (e.g. cs messages said Chybný email while users have always seen Neplatný e-mail from validators), which confirms they were never rendered.

Commit 2 — move the remainder (behaviour changes, all improvements)

The remaining 9 entries had no copy in the serving domain, so they are moved rather than deleted:

Target Moved in
security.fr You have to login…
security.nl You have to login…
validators.hu user.not_valid_email, user.not_valid_password
validators.zh_CN user.not_valid_display_name, user.not_valid_email, user.not_valid_password

These four locales previously fell back to English for these keys and now show their own translation. Verified against the live translator across all 16 locales: exactly these 7 lookups change, nothing else.

The two remaining messages.nl entries are dropped rather than moved. Their targets were English (Invalid email, Invalid password) rather than Dutch, and the truncated password string would have shadowed the fuller en fallback (Invalid password. The password should contain at least 6 characters.). Dropping them leaves nl rendering unchanged.

The messages domain no longer contains any of the four keys, for any locale.

Commit 3 — upgrade notes

Adds a Removed translations section to UPGRADING.md listing the removed keys, their serving domain, and what consumers should do.

bin/console lint:xliff translations/ passes on all 44 files.

@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.

@Vondry
Vondry changed the base branch from 6.1 to 6.2 August 14, 2026 09:10
@Vondry
Vondry force-pushed the fix/remove-wrong-domain-duplicates branch 2 times, most recently from 15f5773 to d3aee59 Compare August 14, 2026 09:14
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 d3aee59 to f7a2412 Compare August 14, 2026 09:26
Vondry added 2 commits August 14, 2026 11:30
…omain

The previous commit removed the `user.not_valid_*` and login entries from
the `messages` domain only where the serving domain (`validators` /
`security`) already held the same key. Nine entries were left behind
because their locale had no copy in the serving domain, so deleting them
outright would have discarded translated text.

Those entries are moved into the domain that actually resolves them:

  security.fr      <- You have to login in order to access this page.
  security.nl      <- You have to login in order to access this page.
  validators.hu    <- user.not_valid_email, user.not_valid_password
  validators.zh_CN <- user.not_valid_display_name, user.not_valid_email,
                      user.not_valid_password

Unlike the previous commit this does change rendered output, in every
case by replacing an English fallback with the existing translation:
fr and nl now show a translated login warning, hu and zh_CN translated
validation messages.

The two remaining `messages.nl` entries are dropped rather than moved.
Their targets were English ("Invalid email", "Invalid password"), never
Dutch, and the truncated password string is worse than the `en` fallback
it would have shadowed. Dropping them leaves nl rendering unchanged.

The `messages` domain no longer contains any of the four keys.
…domain

These keys are unreachable from `messages` (Symfony has no domain
fallback), so Bolt's own rendering is unaffected, but consumers
translating them from `messages` in their own code or templates need to
switch domain.
@Vondry

Vondry commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

All should be done :)

@Vondry
Vondry requested a review from bobvandevijver August 14, 2026 09:36
@Vondry Vondry changed the title Remove messages entries that are only ever served by another domain Remove four keys from the messages domain, moving remaining translations to validators/security Aug 14, 2026
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