Skip to content

Commit

Permalink
Fix includeOriginals option not working without namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkwinkelmann committed Mar 9, 2021
1 parent b48a537 commit c4dd6a6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Api/Controllers/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ public function handle(ServerRequestInterface $request): ResponseInterface
*/
$catalogue = app('translator')->getCatalogue($locale);

$originals = array_filter($catalogue->all('messages'), function ($key) use ($namespace) {
return Str::startsWith($key, $namespace . '.');
}, ARRAY_FILTER_USE_KEY);
$originals = $catalogue->all('messages');

if ($namespace) {
$originals = array_filter($originals, function ($key) use ($namespace) {
return Str::startsWith($key, $namespace . '.');
}, ARRAY_FILTER_USE_KEY);
}

// Complete base with original translations if they are not customized
$translations = collect($originals)->merge($translations);
Expand Down

0 comments on commit c4dd6a6

Please sign in to comment.