Skip to content

Commit

Permalink
[Fix] lang_path for Laravel 9 (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
amiranagram authored Jan 16, 2023
1 parent 6e9f4aa commit 9989fd2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
}
},
"scripts": {
"psalm": "vendor/bin/psalm",
"test": "vendor/bin/phpunit --colors=always",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage",
"act": "act -P ubuntu-latest=shivammathur/node:latest -j"
Expand Down
4 changes: 3 additions & 1 deletion src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
function lang_path($path = '')
{
return resource_path('lang'.($path !== '' ? DIRECTORY_SEPARATOR.$path : ''));
return version_compare(app()->version(), '9.0', '>=')
? app()->langPath($path)
: resource_path('lang'.($path !== '' ? DIRECTORY_SEPARATOR.$path : ''));
}
}
3 changes: 1 addition & 2 deletions tests/LocalizatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ public function testDirectoriesAreBeingExcluded(): void
$this->createTestView("{{ __('Baz') }}", 'sub2/test');

config([
'localizator.sort' => false,
'localizator.search.exclude' => 'sub1',
]);

Expand All @@ -356,8 +355,8 @@ public function testDirectoriesAreBeingExcluded(): void
// Do their contents match the expected results?
$contents = $this->getJsonLangContents('en');
self::assertSame([
'Foo' => 'Foo',
'Baz' => 'Baz',
'Foo' => 'Foo',
], $contents);

// Cleanup.
Expand Down

0 comments on commit 9989fd2

Please sign in to comment.