Skip to content

feat(i18n): consume central translations from escalated-dev/locale#53

Merged
mpge merged 4 commits intomasterfrom
feat/central-locale
May 2, 2026
Merged

feat(i18n): consume central translations from escalated-dev/locale#53
mpge merged 4 commits intomasterfrom
feat/central-locale

Conversation

@mpge
Copy link
Copy Markdown
Member

@mpge mpge commented May 2, 2026

Summary

Wires this bundle to consume UI translations from the central
escalated-dev/locale
Composer package instead of carrying its own copy in perpetuity.

  • composer.json now requires escalated-dev/locale: ^0.1 (additive,
    preserves the existing multi-major constraint idiom established by chore(deps): widen multi-major constraints #52).
  • EscalatedBundle::prependExtension() registers the central package's
    translations/ directory onto framework.translator.paths, with the
    plugin-local translations/ directory listed after it so it (and the
    host app's translations/) continue to override on a per-key basis.
  • The plugin-local translations/ directory is unchanged and serves as
    the override location — no translation content is modified by this PR.
  • README gains a Translations section explaining the override semantics;
    CHANGELOG records the change under [Unreleased].

Wiring details

The central package is a plain Composer library, not a Symfony bundle, so
it cannot self-register. The bundle's prependExtension resolves the
installed package's translations/ path at boot and prepends it onto
framework.translator.paths. Symfony's translator gives later-registered
paths higher priority, which is why the order is:

  1. vendor/escalated-dev/locale/translations (central, low priority)
  2. <bundle>/translations (plugin-local, higher priority)
  3. The host app's own translations/ (highest, auto-discovered)

A null guard around the path lookup keeps the bundle bootable in
isolated test environments where the central package isn't installed.

Blocked

Blocked on escalated-dev/escalated-locale v0.1.0 Packagist publish.

CI will fail at composer install until the central package tags v0.1.0
and is registered on Packagist. Marked as draft until then.

Test plan

  • escalated-dev/locale v0.1.0 published to Packagist
  • composer install resolves successfully on CI
  • composer install resolves locally on PHP 8.2 / 8.3
  • Bundle boots in a Symfony 6.4 host and the central translations
    appear via bin/console debug:translation <locale>
  • Bundle boots in a Symfony 7.x host (same check)
  • Dropping a single key into the host app's translations/messages.en.yaml
    overrides the central package's value

mpge added 3 commits May 1, 2026 22:10
Adds the central locale Composer package to require and prepends its
translations/ directory onto framework.translator.paths via the bundle's
prependExtension hook. The plugin-local translations/ path is registered
after the central path so it remains higher priority and can override
individual keys.
Adds a Translations section to the README explaining that strings are
sourced from escalated-dev/locale and overridable by the plugin-local or
host app translations/ directories. Notes the change in CHANGELOG.
Composer resolves escalated-dev/locale ^0.1 from
github.com/escalated-dev/escalated-locale via vcs repository (v0.1.1
tag). Once the package is submitted to Packagist this block can be
removed.
@mpge mpge marked this pull request as ready for review May 2, 2026 19:24
@mpge mpge merged commit d8bc94b into master May 2, 2026
1 check passed
@mpge mpge deleted the feat/central-locale branch May 2, 2026 19:34
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