Translations FileLoader implementation work incorrectly with custom paths binding #49573
Replies: 3 comments
-
Would be great if this can be release as hotfix soon, because it blocks our work a bit :) And thanks for the great work and that these parameters are their, event with small bug :) |
Beta Was this translation helpful? Give feedback.
-
This clearly indicates that this is a feature request and not a bug report. |
Beta Was this translation helpful? Give feedback.
-
In any way, I added a Pull Request with all required unit tests, which cover the described situation: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
10.39
PHP Version
8.2.13
Database Driver & Version
not related
Description
In case you re-register translation Loader contract and add more paths, that the standard ones (which are illuminate langs and app langs) - then namespaces overrides works incorrectly.
The last element overrides all previous paths.
My vision that is should replace recursively all the available overrides, in this case you can specify only custom lines you need to change.
(In my case, I'm creating a package, which may override some vendor translations, but app should have higher priority)
Steps To Reproduce
Register this provider in config
Define some name lang namespace path in AppServiceProvider like
$this->loadTranslationsFrom(base_path('lib/custom-package/lang'), 'package');
Create lang files in both lang paths:
trans('package::test.foo')
. You will getbar
, notbar2
. Futhermore, youtrans('package::test.fruit')
also won't have a translationBeta Was this translation helpful? Give feedback.
All reactions