-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for packages loadTranslationsFrom method #149
base: master
Are you sure you want to change the base?
added support for packages loadTranslationsFrom method #149
Conversation
…sanlationsFrom with override ability from local language vendor folder
|
||
$fullPath = $file->getRealPath(); | ||
if ($extension == 'php') { | ||
$messages[$key] = array_replace(Arr::get($messages,$key,[]), include $fullPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to check the include $fullPath
actually returns a filled array before adding it.
You can add a test for it for trying to include a translation file, that isn't a valid translation file.
{ | ||
$pathName = $file->getRelativePathName(); | ||
$extension = $file->getExtension(); | ||
if ($extension != 'php' && $extension != 'json') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change it to for readability
$supportedExtensions = ['json', 'php'];
!in_array($extension, $supportedExtensions)
I'm thinking laravel actually does this already somehow, maybe we should look into
The Illuminate\Translation\Translator
uses Illuminate\Translation\FileLoader
to load/process files. Maybe we can use some of that logic
Seems like this ain't appyling to 1.7.0 for laravel 8 anymore |
…lization into packages-loadTranslationsFrom-support
…ationsFrom-support
added support for packages which register language files via loadTranslationsFrom with override ability from local language vendor folder