Skip to content

Commit

Permalink
Don't load *. translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarpsvo committed Nov 23, 2020
1 parent 26af343 commit 1988407
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/LoadsNovaTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private function translations($pckgTransDir, $pckgName, $publish)
$locale = app()->getLocale();
$fallbackLocale = config('app.fallback_locale');

// Load PHP translations
// Load Laravel translations
$this->loadLaravelTranslations($pckgTransDir, $pckgName);

// Attempt to load Nova translations
Expand Down Expand Up @@ -86,11 +86,11 @@ private function loadLaravelTranslationsForLocale($locale, $pckgTransDir, $pckgN
$packageTranslations = isset($packageTransFile) ? json_decode(file_get_contents($packageTransFile), true) : [];
$translations = array_merge($packageTranslations, $projectTranslations);

$lines = collect($translations)->mapWithKeys(function ($value, $key) {
return [Str::contains($key, '.') ? $key : "*.$key" => $value];
$translations = collect($translations)->filter(function ($value, $key) {
return Str::contains($key, '.');
})->toArray();

app('translator')->addLines($lines, $locale);
app('translator')->addLines($translations, $locale);

return true;
}
Expand Down

0 comments on commit 1988407

Please sign in to comment.