Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,15 @@ public function register()

if ($laravelMajorVersion === 4) {
$langs = $app['path.base'].'/app/lang';
} elseif ($laravelMajorVersion >= 9) {
}

// this is the path used by 5..8 laravel versions try to use it first.
$langs = $app['path.base'].'/resources/lang';

if (!is_dir($langs)) {
$langs = $app['path.base'].'/lang';
} elseif ($laravelMajorVersion >= 5) {
$langs = $app['path.base'].'/resources/lang';
}

$messages = $app['config']->get('localization-js.messages');
$generator = new Generators\LangJsGenerator($files, $langs, $messages);

Expand Down
9 changes: 3 additions & 6 deletions tests/specs/LangJsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,9 @@ class LangJsCommandTest extends TestCase
*/
private $langPath;

/**
* LangJsCommandTest constructor.
*/
public function __construct()
protected function setUp(): void
{
parent::__construct();
parent::setUp();

$this->testPath = __DIR__ . '/..';
$this->rootPath = __DIR__ . '/../..';
Expand Down Expand Up @@ -240,7 +237,7 @@ public function testShouldIgnoreDefaultOutputPathFromConfigIfTargetArgumentExist
$code = $this->runCommand($command, ['target' => $this->outputFilePath]);
$this->assertRunsWithSuccess($code);
$this->assertFileExists($this->outputFilePath);
$this->assertFileNotExists($customOutputFilePath);
$this->assertFileDoesNotExist($customOutputFilePath);

$template = "$this->rootPath/src/Mariuzzo/LaravelJsLocalization/Generators/Templates/langjs_with_messages.js";
$this->assertFileExists($template);
Expand Down