First stable release. The public API of the previous 0.2 line — _r() /
_e() and the fluent setters — is preserved, so existing code keeps working.
- Requires PHP 8.1+ (was 7.4+).
- Default-language fallback now works for nested (dot-delimited) keys. Nested lookups were always resolved against the active language, so a key present only in the default language was never found and the key was returned verbatim. Affected both the file and directory layouts.
- Requesting a key that resolves to a nested array no longer throws a
TypeError. Such a namespace node is treated as a miss and falls through the resolution chain. - Inline fallbacks of
'0'and''are honoured. The provided-fallback check usedempty(), which discarded these values; it now checks fornull.
translate()andrender()as the primary, descriptive methods (returning and echoing, respectively).- Clear
TranslatorExceptionmessages for misconfiguration: directory not set, language file/directory missing, a directory that cannot be read, a file that does not return an array, and changing the file/directory mode after a language has been loaded. - English documentation under
docs/, a rewrittenREADME.md, a GitHub Actions CI workflow, PHPStan (level max) and PHP-CS-Fixer configuration, and a comprehensive test suite.
_r()and_e()are now thin, deprecated aliases oftranslate()andrender(). They remain fully functional for backward compatibility.Translatoris nowfinaland implements the documentedTranslatorInterface. Depend on the interface rather than subclassing.- Calling
useFile()/useDirectory()after a language has been loaded now throws aTranslatorExceptioninstead of silently leaving the translator in an inconsistent state.