From bd228fd1271a6d8c9d000a88e3013a9bf2a3ae29 Mon Sep 17 00:00:00 2001 From: Marco Kaiser Date: Tue, 5 Mar 2024 14:28:46 +0100 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20Changes=20the=20used=20function?= =?UTF-8?q?=20to=20export=20the=20language=20files=20-=20`base=5Fpath('lan?= =?UTF-8?q?g/=E2=80=A6')`=20is=20no=20longer=20needed=20and=20error-prone?= =?UTF-8?q?=20because=20of=20the=20change=20of=20the=20language=20path=20i?= =?UTF-8?q?n=20Laravel=209?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Linguist.php | 4 ++-- tests/LinguistTest.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Linguist.php b/src/Linguist.php index 43fee65..a47042e 100755 --- a/src/Linguist.php +++ b/src/Linguist.php @@ -159,7 +159,7 @@ protected function ensureDirectoriesExist(): void $paths = collect(); $this->languages->each(function ($language) use (&$paths) { - $paths->push(base_path("lang/$language")); + $paths->push(lang_path("$language")); }); $paths->push(storage_path($this->getTemporaryDirectory())); @@ -228,7 +228,7 @@ public function moveFiles(): self foreach ($files as $file) { $language = $file->getFilenameWithoutExtension(); - $destination = base_path("lang/$language/$this->project.json"); + $destination = lang_path("$language/$this->project.json"); File::move($file, $destination); } diff --git a/tests/LinguistTest.php b/tests/LinguistTest.php index 4cd88ae..6862d85 100644 --- a/tests/LinguistTest.php +++ b/tests/LinguistTest.php @@ -20,12 +20,12 @@ function cleanUp(): void { - if (File::exists(base_path('lang'))) { - collect(File::files(base_path('lang')))->each(function (SplFileInfo $file) { + if (File::exists(lang_path())) { + collect(File::files(lang_path()))->each(function (SplFileInfo $file) { File::delete($file->getPathname()); }); - File::deleteDirectory(base_path('lang')); + File::deleteDirectory(lang_path()); } if (File::exists(storage_path('tmp/translations'))) { @@ -101,7 +101,7 @@ function cleanUp(): void ->createDirectories(); $languages->each(function (string $language) { - assertFileExists(base_path("lang/$language")); + assertFileExists(lang_path("$language")); }); assertFileExists(storage_path(config('linguist.temporary_directory'))); @@ -156,7 +156,7 @@ function cleanUp(): void ->moveFiles(); $languages->each(function (string $language) { - assertFileExists(base_path("lang/$language/project.json")); + assertFileExists(lang_path("$language/project.json")); }); assertFileDoesNotExist(storage_path(config('linguist.temporary_directory'))); @@ -192,7 +192,7 @@ function cleanUp(): void Linguist::start()->handle(); $languages->each(function (string $language) { - assertFileExists(base_path("lang/$language/project.json")); + assertFileExists(lang_path("$language/project.json")); }); assertFileDoesNotExist(storage_path(config('linguist.temporary_directory'))); From 6a44817a39589f8b95123857c8e0a772157cb8b9 Mon Sep 17 00:00:00 2001 From: Marco Kaiser Date: Tue, 5 Mar 2024 14:42:10 +0100 Subject: [PATCH 2/2] chore: Remove unnecessary quotes Co-authored-by: Bruno <39590058+Katalam@users.noreply.github.com> --- src/Linguist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Linguist.php b/src/Linguist.php index a47042e..6ede666 100755 --- a/src/Linguist.php +++ b/src/Linguist.php @@ -159,7 +159,7 @@ protected function ensureDirectoriesExist(): void $paths = collect(); $this->languages->each(function ($language) use (&$paths) { - $paths->push(lang_path("$language")); + $paths->push(lang_path($language)); }); $paths->push(storage_path($this->getTemporaryDirectory()));