Releases: phpnomad/translate
Releases · phpnomad/translate
Release list
2.0.2
2.0.1
Security hardening
- HeaderLanguageProvider: the attacker-controlled
Accept-Languageheader 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
Breaking Changes
TranslationStrategyinterface redesigned: singletranslate()method replaced with a 2-method APItranslate(string $text, ?string $context = null): stringtranslatePlural(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
HeaderLanguageProvidernamespace fixed fromSiren\Translations\Service\ProviderstoPHPNomad\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
Code breaks free, unbound
Nomadic paths unfurling
Fresh start awakens