From 9db9e1a6474b492c11a8a8b05c6c1fbfc49e99f2 Mon Sep 17 00:00:00 2001 From: Quentin Gabriele Date: Thu, 20 Jun 2024 16:39:27 +0200 Subject: [PATCH] add spin --- src/Commands/FixGrammarTranslationsCommand.php | 15 ++++++++++----- src/Commands/TranslateTranslationsCommand.php | 17 +++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/Commands/FixGrammarTranslationsCommand.php b/src/Commands/FixGrammarTranslationsCommand.php index b7bd6e9..9407eb6 100644 --- a/src/Commands/FixGrammarTranslationsCommand.php +++ b/src/Commands/FixGrammarTranslationsCommand.php @@ -5,6 +5,8 @@ use Elegantly\Translator\Facades\Translator; use Illuminate\Console\Command; +use function Laravel\Prompts\spin; + class FixGrammarTranslationsCommand extends Command { use TranslatorCommandTrait; @@ -45,11 +47,14 @@ public function handle(): int continue; } - $translations = Translator::fixGrammarTranslations( - $locale, - $namespace, - $keys, - $service + $translations = spin( + fn () => Translator::fixGrammarTranslations( + $locale, + $namespace, + $keys, + $service + ), + 'Fetching response...' ); $this->table( diff --git a/src/Commands/TranslateTranslationsCommand.php b/src/Commands/TranslateTranslationsCommand.php index d27570c..dba6465 100644 --- a/src/Commands/TranslateTranslationsCommand.php +++ b/src/Commands/TranslateTranslationsCommand.php @@ -5,6 +5,8 @@ use Elegantly\Translator\Facades\Translator; use Illuminate\Console\Command; +use function Laravel\Prompts\spin; + class TranslateTranslationsCommand extends Command { use TranslatorCommandTrait; @@ -49,12 +51,15 @@ public function handle(): int continue; } - $translations = Translator::translateTranslations( - $from, - $target, - $namespace, - $keys, - $service + $translations = spin( + fn () => Translator::translateTranslations( + $from, + $target, + $namespace, + $keys, + $service + ), + 'Fetching response...' ); $this->table(