Skip to content

Commit

Permalink
grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Jun 19, 2024
1 parent f1ad42d commit a8b4a0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/Commands/FixGrammarTranslationsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ class FixGrammarTranslationsCommand extends Command
public function handle(): int
{
$serviceArg = $this->option('service');
$localesArg = explode(",", (string) $this->option('locales'));
$localesArg = explode(',', (string) $this->option('locales'));

$service = TranslatorServiceProvider::getGrammarServiceFromConfig($serviceArg);

$locales = collect(Translator::getLanguages())
->when($localesArg, fn (Collection $items) => $items->intersect($localesArg));


foreach ($locales as $locale) {

$this->info("Fixing grammar in '{$locale}' locale:");
$this->line('Using service ' . get_class($service));
$this->line('Using service '.get_class($service));

$namespaces = Translator::getNamespaces($locale);

Expand All @@ -38,8 +37,8 @@ public function handle(): int
->keys()
->toArray();

$this->line(count($keys) . " keys to fix found in {$locale}/{$namespace}.php");
if (!$this->confirm("Would you like to continue?", true)) {
$this->line(count($keys)." keys to fix found in {$locale}/{$namespace}.php");
if (! $this->confirm('Would you like to continue?', true)) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Commands/TranslateTranslationsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function handle(): int

$this->info("Translating from '{$from}' to '{$target}':");
if ($service) {
$this->line('Using custom service ' . get_class($service));
$this->line('Using custom service '.get_class($service));
}

foreach ($namespaces as $namespace) {
Expand All @@ -42,7 +42,7 @@ public function handle(): int
$keys = Translator::getMissingTranslations($from, $target, $namespace);
}

if (!$this->confirm(count($keys) . " keys to translate found in {$target}/{$namespace}.php, would you like to continue?", true)) {
if (! $this->confirm(count($keys)." keys to translate found in {$target}/{$namespace}.php, would you like to continue?", true)) {
continue;
}

Expand Down

0 comments on commit a8b4a0a

Please sign in to comment.