Skip to content

Commit

Permalink
Add Laravel 8 support again
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarpsvo committed Apr 29, 2022
1 parent 6152881 commit ef76f05
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/LoadsNovaTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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";

Expand All @@ -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, '/');
}
}

0 comments on commit ef76f05

Please sign in to comment.