Skip to content

v2.0.0

Choose a tag to compare

@paullla paullla released this 07 Jul 12:24
049e721

v2.0.0 restores honest versioning and wide platform support after the mis-tagged v1.4.1, and fixes the long-standing translation write behavior.

See UPGRADE-2.0.md for step-by-step upgrade instructions.

Highlights

Translation writes reconciled in place (#81)

Nested translation writes no longer recreate the whole collection. Each submitted locale updates its existing translation row, keeping ids stable and unique constraints intact (fixes #61, the root cause behind #36 and #54):

  • PATCH (application/merge-patch+json) updates the submitted locales and leaves the others untouched. This is the recommended way to edit translations and needs no configuration.
  • PUT is a full replace: locales absent from the payload are removed. PUT requires API Platform's standard_put to be disabled, per operation (extraProperties: ['standard_put' => false]) or globally (api_platform.defaults.extra_properties.standard_put: false). A misconfigured PUT fails with an explicit error telling you exactly that, instead of an obscure Doctrine exception.

Wide platform support restored (#76)

v1.4.1 silently raised the floor to PHP 8.4 and API Platform 4.2. v2.0.0 goes back to supporting the platforms the code actually runs on:

v1.4 v1.4.1 v2.0.0
PHP ^8.1 >=8.4 ^8.2
API Platform ^2.1 || ^3.0 ^4.2 ^3.4 || ^4.0
Doctrine ORM ^3.0 ^3.5 ^3.0

API Platform 2 users: stay on v1.4; critical fixes land on the new 1.x branch.

Locale validation (#71)

When framework.enabled_locales is configured, requested locales outside the list (?locale= or Accept-Language) now fall back to the default locale instead of being accepted verbatim. Thanks @maxhelias for the contribution.

Breaking changes

All breaking changes are listed in the CHANGELOG with upgrade steps in UPGRADE-2.0.md:

  1. Dependency floors (PHP ^8.2, api-platform/symfony, Doctrine ORM 3).
  2. Translator implements LocaleAwareInterface and declares parameter types.
  3. AssignLocaleListener signatures use Doctrine\Persistence\Event\LifecycleEventArgs.
  4. Out-of-list locales fall back to the default locale when enabled_locales is set.
  5. Translation writes are reconciled in place; PUT needs standard_put disabled.

Quality

  • PHPStan level 6 and php-cs-fixer enforced in CI (#78)
  • CI matrix: PHP 8.2 to 8.5 plus a lowest-dependencies leg (#76)
  • Model edge-case tests and a kernel smoke test booting Framework + Doctrine + API Platform (#80)
  • Modernized README with attribute-based examples (#77), community files (#79)

Thanks to @maxhelias and @tacman for their contributions.