Skip to content

Releases: phpnomad/translate

2.0.2

Choose a tag to compare

@alexstandiford alexstandiford released this 12 Jun 10:58

Packaging hygiene: tests, CI, and tool configs are now excluded from dist archives (export-ignore); LICENSE metadata ensured. No code changes.

2.0.1

Choose a tag to compare

@alexstandiford alexstandiford released this 11 Jun 15:08

Security hardening

  • HeaderLanguageProvider: the attacker-controlled Accept-Language header is now validated against the language-tag shape instead of being exploded raw; only the two-letter primary subtag is returned, and malformed input resolves to null. (phpnomad/wordpress-integration#34, PR #5)

v2.0.0

Choose a tag to compare

@alexstandiford alexstandiford released this 31 Mar 11:31

Breaking Changes

  • TranslationStrategy interface redesigned: single translate() method replaced with a 2-method API
    • translate(string $text, ?string $context = null): string
    • translatePlural(string $singular, string $plural, int $count, ?string $context = null): string
  • Domain and locale removed from the interface — they are now implementation concerns resolved by injected providers
  • HeaderLanguageProvider namespace fixed from Siren\Translations\Service\Providers to PHPNomad\Translations\Providers

Why

The previous interface had no pluralization support and a bug in the WordPress implementation (domain passed as context to _x()). The new design:

  • Maps 1:1 to gettext's four operations (translate, translate+context, plural, plural+context)
  • Keeps call sites clean (max 4 args on the most complex call)
  • Is extractable by standard tools (xgettext, wp i18n make-pot)
  • Supports WordPress, Symfony, and native gettext implementations

1.0.0

Choose a tag to compare

@alexstandiford alexstandiford released this 18 Dec 16:47

Code breaks free, unbound
Nomadic paths unfurling
Fresh start awakens