Skip to content

Commit

Permalink
update locale completion
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenkhoo committed Oct 25, 2021
1 parent 6e3598b commit 7cfc2b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Expand Up @@ -22,6 +22,7 @@
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Intl\Locales;
use Symfony\Component\Translation\Catalogue\MergeOperation;
use Symfony\Component\Translation\Catalogue\TargetOperation;
use Symfony\Component\Translation\Extractor\ExtractorInterface;
Expand Down Expand Up @@ -310,6 +311,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
{
if ($input->mustSuggestArgumentValuesFor('locale')) {
$suggestions->suggestValues(Locales::getLocales());

return;
}

Expand Down
Expand Up @@ -20,6 +20,7 @@
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Intl\Locales;
use Symfony\Component\Translation\Extractor\ExtractorInterface;
use Symfony\Component\Translation\Reader\TranslationReader;
use Symfony\Component\Translation\Translator;
Expand All @@ -44,6 +45,7 @@ public function testComplete(array $input, array $expectedSuggestions)

public function provideCompletionSuggestions()
{
yield 'locale' => [[''], Locales::getLocales()];
yield 'bundle' => [['en', ''], ['BaseBundle']];
yield 'domain with locale' => [['en', '--domain=m'], ['messages']];
yield 'domain without locale' => [['--domain=m'], []];
Expand Down

0 comments on commit 7cfc2b8

Please sign in to comment.