From ef76f05593f4ae781f9d43bb071da6516e793d3f Mon Sep 17 00:00:00 2001 From: Tarvo Reinpalu Date: Fri, 29 Apr 2022 17:58:45 +0300 Subject: [PATCH] Add Laravel 8 support again --- src/LoadsNovaTranslations.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/LoadsNovaTranslations.php b/src/LoadsNovaTranslations.php index 22a5450..85b3e19 100644 --- a/src/LoadsNovaTranslations.php +++ b/src/LoadsNovaTranslations.php @@ -33,7 +33,7 @@ protected function loadTranslations($packageTranslationsDir, $packageName, $publ private function translations($pckgTransDir, $pckgName, $publish) { if (app()->runningInConsole() && $publish) { - $this->publishes([$pckgTransDir => lang_path("vendor/{$pckgName}")], 'translations'); + $this->publishes([$pckgTransDir => $this->langPath("vendor/{$pckgName}")], 'translations'); return; } @@ -101,7 +101,7 @@ private function getTranslationsFile($locale, $from, $packageTranslationsDir, $p $fileDir = $from === 'local' ? $packageTranslationsDir - : lang_path("vendor/{$packageName}"); + : $this->langPath("vendor/{$packageName}"); $filePath = "$fileDir/{$locale}.json"; @@ -113,4 +113,10 @@ private function getTranslationsFile($locale, $from, $packageTranslationsDir, $p return !empty($fileContents) ? $filePath : null; } + + // Adds Laravel 8 support where 'lang_path' helper does not exist + private function langPath($path) + { + return app()->langPath() . '/' . ltrim($path, '/'); + } }