Skip to content

Commit

Permalink
Merge pull request #5 from hexadog/develop
Browse files Browse the repository at this point in the history
fix(*): issue with missing command and namespaces
  • Loading branch information
gaetan-hexadog authored Nov 28, 2021
2 parents d71d2ba + f162a16 commit 992c89f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/TranslationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function findMissing($namespaces = null, $languages = null, $autoFix = fa

return false;
})->mapWithKeys(function ($value, $key) use ($namespace) {
return [$key => '' !== $namespace ? preg_replace('/^' . $namespace . '::/', '', $value) : ''];
return [$key => '' !== $namespace ? preg_replace('/^' . $namespace . '::/', '', $value) : $value];
})->toArray());
}
}
Expand Down Expand Up @@ -237,8 +237,6 @@ protected function prepareNamespaces($namespaces = null): Collection
{
$namespacesCollection = collect();

$this->translator->addNamespace('hexadog', resource_path('lang'));

// Get Translator namespaces
$loader = $this->translator->getLoader();

Expand All @@ -258,14 +256,14 @@ protected function prepareNamespaces($namespaces = null): Collection
$namespacesCollection = $namespacesCollection->filter(function ($path, $namespace) use ($namespaces) {
return $namespaces->contains($namespace);
});
} else {
// Add default namespace
$namespacesCollection->put('', resource_path('lang'));
}

// Add default namespace
$namespacesCollection->put('', resource_path('lang'));

// Return namespaces collection after removing non existing paths
return $namespacesCollection->filter(function ($path) {
return file_exists($path);
return file_exists($path) ? $path : false;
});
}

Expand Down

0 comments on commit 992c89f

Please sign in to comment.