Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

added support for packages loadTranslationsFrom method #149

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

Open
MeRoBo wants to merge 5 commits into rmariuzzo:master
base: master
Choose a base branch
Loading
from MeRoBo:packages-loadTranslationsFrom-support

Conversation

Copy link

@MeRoBo MeRoBo commented Aug 25, 2020

added support for packages which register language files via loadTranslationsFrom with override ability from local language vendor folder

eossa reacted with thumbs up emoji
...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);
Copy link

@StefanPrintezis StefanPrintezis Sep 8, 2020
edited
Loading

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') {
Copy link

@StefanPrintezis StefanPrintezis Sep 8, 2020

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\FileLoaderto load/process files. Maybe we can use some of that logic

Copy link

Seems like this ain't appyling to 1.7.0 for laravel 8 anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@StefanPrintezis StefanPrintezis StefanPrintezis left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /