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, '/'); + } }