Skip to content

Commit

Permalink
fix: allow base locale
Browse files Browse the repository at this point in the history
  • Loading branch information
nerg4l committed Aug 13, 2024
1 parent 9ae5fcc commit a9c5b7f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Console/Commands/FindMissingTranslationStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ public function handle(LostInTranslation $lit)
$baseLocale = config('lost-in-translation.locale');
$locale = $this->argument('locale');

if ($baseLocale === $locale) {
$this->error("Locale `{$locale}` must be different from `{$baseLocale}`.");

return;
}

$missing = $this->findInArray($baseLocale, $locale);

$files = $this->collectFiles();
Expand Down Expand Up @@ -133,11 +127,14 @@ protected function printErrors(array $errors, OutputInterface $output): void

/**
* @param string $baseLocale
* @param string|null $locale
* @param mixed $locale
* @return \Illuminate\Support\Collection
*/
protected function findInArray(mixed $baseLocale, string|null $locale)
protected function findInArray(string $baseLocale, mixed $locale)
{
if ($baseLocale === $locale) {
return Collection::empty();
}
return Collection::make($this->files->files(lang_path($baseLocale)))
->mapWithKeys(function (SplFileInfo $file) {
return [$file->getFilenameWithoutExtension() => $this->translator->get($file->getFilenameWithoutExtension())];
Expand Down

0 comments on commit a9c5b7f

Please sign in to comment.