Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6cd50d7

Browse files
committed
modifying locale completion for only enabled locales, and inject during config/console for the enabled locales value
1 parent7cfc2b8 commit6cd50d7

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
useSymfony\Component\Console\Style\SymfonyStyle;
2323
useSymfony\Component\HttpKernel\Bundle\BundleInterface;
2424
useSymfony\Component\HttpKernel\KernelInterface;
25-
useSymfony\Component\Intl\Locales;
2625
useSymfony\Component\Translation\Catalogue\MergeOperation;
2726
useSymfony\Component\Translation\Catalogue\TargetOperation;
2827
useSymfony\Component\Translation\Extractor\ExtractorInterface;
@@ -60,8 +59,9 @@ class TranslationUpdateCommand extends Command
6059
private$defaultViewsPath;
6160
private$transPaths;
6261
private$codePaths;
62+
private$enabledLocales;
6363

64-
publicfunction__construct(TranslationWriterInterface$writer,TranslationReaderInterface$reader,ExtractorInterface$extractor,string$defaultLocale,string$defaultTransPath =null,string$defaultViewsPath =null,array$transPaths = [],array$codePaths = [])
64+
publicfunction__construct(TranslationWriterInterface$writer,TranslationReaderInterface$reader,ExtractorInterface$extractor,string$defaultLocale,string$defaultTransPath =null,string$defaultViewsPath =null,array$transPaths = [],array$codePaths = [],array$enabledLocales = [])
6565
{
6666
parent::__construct();
6767

@@ -73,6 +73,7 @@ public function __construct(TranslationWriterInterface $writer, TranslationReade
7373
$this->defaultViewsPath =$defaultViewsPath;
7474
$this->transPaths =$transPaths;
7575
$this->codePaths =$codePaths;
76+
$this->enabledLocales =$enabledLocales;
7677
}
7778

7879
/**
@@ -311,7 +312,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
311312
publicfunctioncomplete(CompletionInput$input,CompletionSuggestions$suggestions):void
312313
{
313314
if ($input->mustSuggestArgumentValuesFor('locale')) {
314-
$suggestions->suggestValues(Locales::getLocales());
315+
$suggestions->suggestValues($this->enabledLocales);
315316

316317
return;
317318
}

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/console.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@
236236
null,// twig.default_path
237237
[],// Translator paths
238238
[],// Twig paths
239+
param('kernel.enabled_locales'),
239240
])
240241
->tag('console.command')
241242

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
useSymfony\Component\Filesystem\Filesystem;
2121
useSymfony\Component\HttpKernel\Bundle\BundleInterface;
2222
useSymfony\Component\HttpKernel\KernelInterface;
23-
useSymfony\Component\Intl\Locales;
2423
useSymfony\Component\Translation\Extractor\ExtractorInterface;
2524
useSymfony\Component\Translation\Reader\TranslationReader;
2625
useSymfony\Component\Translation\Translator;
@@ -45,7 +44,7 @@ public function testComplete(array $input, array $expectedSuggestions)
4544

4645
publicfunctionprovideCompletionSuggestions()
4746
{
48-
yield'locale' => [[''],Locales::getLocales()];
47+
yield'locale' => [[''],['en','fr']];
4948
yield'bundle' => [['en',''], ['BaseBundle']];
5049
yield'domain with locale' => [['en','--domain=m'], ['messages']];
5150
yield'domain without locale' => [['--domain=m'], []];
@@ -127,7 +126,7 @@ function ($path, $catalogue) use ($loadedMessages) {
127126
->method('getContainer')
128127
->willReturn($container);
129128

130-
$command =newTranslationUpdateCommand($writer,$loader,$extractor,'en',$this->translationDir.'/translations',$this->translationDir.'/templates',$transPaths,$codePaths);
129+
$command =newTranslationUpdateCommand($writer,$loader,$extractor,'en',$this->translationDir.'/translations',$this->translationDir.'/templates',$transPaths,$codePaths, ['en','fr']);
131130

132131
$application =newApplication($kernel);
133132
$application->add($command);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp