Skip to content

Commit e1fbe43

Browse files
committed
Add translate() and render() methods, deprecate _r() and _e()
1 parent 889f092 commit e1fbe43

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Change Log
2+
3+
## 1.0.0 [2026.06.11]
4+
5+
First stable release. The public API of the previous `0.2` line — `_r()` /
6+
`_e()` and the fluent setters — is preserved, so existing code keeps working.
7+
8+
### Requirements
9+
10+
- **Requires PHP 8.1+** (was 7.4+).
11+
12+
### Fixed
13+
14+
- **Default-language fallback now works for nested (dot-delimited) keys.** Nested
15+
lookups were always resolved against the *active* language, so a key present
16+
only in the default language was never found and the key was returned
17+
verbatim. Affected both the file and directory layouts.
18+
- **Requesting a key that resolves to a nested array no longer throws a
19+
`TypeError`.** Such a namespace node is treated as a miss and falls through the
20+
resolution chain.
21+
- **Inline fallbacks of `'0'` and `''` are honoured.** The provided-fallback
22+
check used `empty()`, which discarded these values; it now checks for `null`.
23+
24+
### Added
25+
26+
- **`translate()`** and **`render()`** as the primary, descriptive methods
27+
(returning and echoing, respectively).
28+
- Clear `TranslatorException` messages for misconfiguration: directory not set,
29+
language file/directory missing, a directory that cannot be read, a file that
30+
does not return an array, and changing the file/directory mode after a language
31+
has been loaded.
32+
- English documentation under `docs/`, a rewritten `README.md`, a GitHub Actions
33+
CI workflow, PHPStan (level max) and PHP-CS-Fixer configuration, and a
34+
comprehensive test suite.
35+
36+
### Changed
37+
38+
- `_r()` and `_e()` are now thin, **deprecated** aliases of `translate()` and
39+
`render()`. They remain fully functional for backward compatibility.
40+
- `Translator` is now `final` and implements the documented `TranslatorInterface`.
41+
Depend on the interface rather than subclassing.
42+
- Calling `useFile()` / `useDirectory()` after a language has been loaded now
43+
throws a `TranslatorException` instead of silently leaving the translator in an
44+
inconsistent state.

0 commit comments

Comments
 (0)