Repository navigation
Commit 0060dd4
committed
fix: core and trees translations never loaded under any locale
Found while fixing the identical bug shape reported in php-tenant.
Both LangServiceProvider::loadTranslations() and Trees\Boot::boot()
registered their translation hint path as the locale subfolder itself
(__DIR__.'/en_GB' and __DIR__.'/Lang/en_GB') instead of its parent.
loadTranslationsFrom() appends "/{locale}/{group}.php" to whatever
hint it is given, so Laravel was looking for
src/Core/Lang/en_GB/en_GB/core.php and
src/Mod/Trees/Lang/en_GB/en_GB/trees.php — neither ever existed. Every
`core::*` key (framework branding/UI text, per this module's own
CLAUDE.md) and every `trees::*` key round-tripped back out as the raw
key instead of resolving, for every locale, since these files were
added.
LangServiceProvider also had a second, now-redundant call guarded by
is_dir(__DIR__.'/en') meant to register a base-locale fallback; folded
away since a single correct hint already covers every locale Laravel
tries via the fallback chain the same provider sets up in
setupFallbackChain().
Added tests/Feature/CoreTranslationsTest.php and
tests/Feature/TreesTranslationsTest.php, each registering the
respective provider directly (the base TestCase only wires
LifecycleEventProvider) and asserting a known key resolves under
en_GB. Both fail on the pre-fix code with the key echoed back
unresolved.
phpstan level 1 clean, pint clean, full Pest suite 448 failed/567
passed (two more passing than before, zero regressions — the 448 are
the pre-existing dappcore/php-tenant-shaped gap noted in the previous
commit).
Co-Authored-By: Virgil <virgil@lethean.io>1 parent e4bce8c commit 0060dd4
4 files changed
Lines changed: 86 additions & 7 deletions
File tree
- src
- Core/Lang
- Mod/Trees
- tests/Feature
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 157 | + | |
153 | 158 | | |
154 | 159 | | |
155 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
0 commit comments