Skip to content

[IT9PE1-30149] Fix the ICU placeholders and name the catalogues after the base language - #37

Merged
fguimier merged 2 commits into
mainfrom
florian_IT9PE1-30149_icu-placeholders
Aug 27, 2026
Merged

[IT9PE1-30149] Fix the ICU placeholders and name the catalogues after the base language#37
fguimier merged 2 commits into
mainfrom
florian_IT9PE1-30149_icu-placeholders

Conversation

@fguimier

@fguimier fguimier commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Refs IT9PE1-30149

  • Follow-up to [IT9PE1-30149] Add the Spanish translation catalogue #36, which merged before this work was pushed. Supersedes Remove the country code in the translation files and add Spanish translation #35 on the rename.
  • ICU placeholders. The domain carries the +intl-icu suffix, so every message is an ICU pattern, where {{ name }} is a syntax error. The three invalid_address.* messages threw on render in every locale, English included: Invalid message format (error #65799): pattern syntax error. They now use the ICU {name} form and render. Nothing surfaced it because InvalidAddressTranslatable has no caller in the backend yet, and the bounce messages that are rendered carry no placeholder — latent, not a live error.
  • Base-language filenames. …en_US.yml…en.yml, and so on. A country-variant name only serves that exact locale; Symfony falls back to the parent, so en serves en_GB and en_US alike. The backend names its own ~2300 catalogues this way and none with a country code.
  • Two guard tests. Every message must parse as an ICU pattern for its locale, and must carry the same placeholders as the reference catalogue, so a {mail} typo no longer renders literally. ext-intl moves into require-dev: it is what parses those patterns.
  • The stray space before the colon goes with it in en and es; French keeps it, its typography wants one.

Test plan

  • Fully covered by automated tests. The rename was additionally verified by booting a kernel with the consuming application's own enabled_locales: ['en_US', 'fr_FR', 'es_ES']: all three resolve to the renamed files, and the ICU messages interpolate.

Shipping

Merging this PR ships nothing: it needs a semver tag / GitHub release, then a
composer require assoconnect/php-smtp-toolbox:^x.y bump PR in the backend. Two reviews total.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

Florian Guimier and others added 2 commits August 27, 2026 10:58
The domain carries the +intl-icu suffix, so every message is an ICU pattern, where `{{ name }}` is a
syntax error. The three invalid_address messages threw on render in every locale, English included:

    Invalid message format (error #65799): pattern syntax error

Nothing surfaced it because the only consumer, InvalidAddressTranslatable, has no caller in the backend
yet, and the bounce messages that are rendered carry no placeholder. The catalogues now use the ICU
`{name}` form and render.

Two tests pin it: every message must parse as an ICU pattern for its locale, and must carry the same
placeholders as the reference catalogue, so a `{mail}` typo no longer renders literally. ext-intl moves
into require-dev, which is what parses those patterns.

The stray space before the colon goes with it in en_US and es_ES; French keeps it, its typography wants
one.

Refs IT9PE1-30149
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The files were named after a country variant, en_US and fr_FR, so they only served those exact locales.
Symfony resolves a locale by falling back to its parent, so a base-language name serves every regional
variant: en_GB and en_US both reach en.

Verified against the consuming application's own configuration, which restricts enabled_locales to
['en_US', 'fr_FR', 'es_ES']: all three still resolve, the restriction does not disable the parent
fallback. The backend names its own ~2300 catalogues this way and none with a country code, so the
bundle was the outlier.

Refs IT9PE1-30149
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fguimier fguimier changed the title [IT9PE1-30149] Render the invalid-address messages as ICU patterns [IT9PE1-30149] Fix the ICU placeholders and name the catalogues after the base language Aug 27, 2026
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@sonarqubecloud

Copy link
Copy Markdown

@fguimier
fguimier merged commit db63766 into main Aug 27, 2026
4 of 5 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant