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

Appearance settings

Commit 4ba2687

Browse filesBrowse files
committed
Move all configuration from XML to PHP
1 parent 793d756 commit 4ba2687
Copy full SHA for 4ba2687

File tree

5 files changed

+76
-19
lines changed
Filter options

5 files changed

+76
-19
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
11051105
}
11061106

11071107
$loader->load('translation.php');
1108-
$loader->load('translation_remotes.xml');
1108+
$loader->load('translation_remotes.php');
11091109

11101110
// Use the "real" translator instead of the identity default
11111111
$container->setAlias('translator', 'translator.default')->setPublic(true);

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/console.php
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
use Symfony\Bundle\FrameworkBundle\Command\SecretsRemoveCommand;
3535
use Symfony\Bundle\FrameworkBundle\Command\SecretsSetCommand;
3636
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
37+
use Symfony\Bundle\FrameworkBundle\Command\TranslationPullCommand;
38+
use Symfony\Bundle\FrameworkBundle\Command\TranslationPushCommand;
3739
use Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand;
3840
use Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand;
3941
use Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand;
@@ -225,6 +227,29 @@
225227
])
226228
->tag('console.command', ['command' => 'translation:update'])
227229

230+
->set('console.command.translation_pull', TranslationPullCommand::class)
231+
->args([
232+
service('translation.remotes'),
233+
service('translation.writer'),
234+
service('translation.reader'),
235+
param('kernel.default_locale'),
236+
param('translator.default_path'),
237+
[], // Translator paths
238+
[], // Enabled locales
239+
])
240+
->tag('console.command', ['command' => 'translation:pull'])
241+
242+
->set('console.command.translation_push', TranslationPushCommand::class)
243+
->args([
244+
service('translation.remotes'),
245+
service('translation.reader'),
246+
param('kernel.default_locale'),
247+
param('translator.default_path'),
248+
[], // Translator paths
249+
[], // Enabled locales
250+
])
251+
->tag('console.command', ['command' => 'translation:push'])
252+
228253
->set('console.command.workflow_dump', WorkflowDumpCommand::class)
229254
->tag('console.command', ['command' => 'workflow:dump'])
230255

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.php
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@
3838
use Symfony\Component\Translation\Loader\PoFileLoader;
3939
use Symfony\Component\Translation\Loader\QtFileLoader;
4040
use Symfony\Component\Translation\Loader\XliffFileLoader;
41+
use Symfony\Component\Translation\Loader\XliffRawLoader;
4142
use Symfony\Component\Translation\Loader\YamlFileLoader;
4243
use Symfony\Component\Translation\LoggingTranslator;
4344
use Symfony\Component\Translation\Reader\TranslationReader;
4445
use Symfony\Component\Translation\Reader\TranslationReaderInterface;
46+
use Symfony\Component\Translation\Remotes;
47+
use Symfony\Component\Translation\RemotesFactory;
4548
use Symfony\Component\Translation\Writer\TranslationWriter;
4649
use Symfony\Component\Translation\Writer\TranslationWriterInterface;
4750
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -84,6 +87,9 @@
8487
->set('translation.loader.xliff', XliffFileLoader::class)
8588
->tag('translation.loader', ['alias' => 'xlf', 'legacy-alias' => 'xliff'])
8689

90+
->set('translation.loader.xliff_raw', XliffRawLoader::class)
91+
->tag('translation.loader', ['alias' => 'xlf_raw'])
92+
8793
->set('translation.loader.po', PoFileLoader::class)
8894
->tag('translation.loader', ['alias' => 'po'])
8995

@@ -158,5 +164,17 @@
158164
->args([service(ContainerInterface::class)])
159165
->tag('container.service_subscriber', ['id' => 'translator'])
160166
->tag('kernel.cache_warmer')
167+
168+
->set('translation.remotes', Remotes::class)
169+
->factory([service('translation.remotes_factory'), 'fromConfig'])
170+
->args([
171+
[], // transports
172+
])
173+
174+
->set('translation.remotes_factory', RemotesFactory::class)
175+
->args([
176+
tagged_iterator('translation.remote_factory'),
177+
[], // Enabled locales
178+
])
161179
;
162180
};
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13+
14+
use Symfony\Component\Translation\Bridge\Loco\LocoRemoteFactory;
15+
use Symfony\Component\Translation\Remote\AbstractRemoteFactory;
16+
17+
return static function (ContainerConfigurator $container) {
18+
$container->services()
19+
->set('translation.remote_factory.abstract', AbstractRemoteFactory::class)
20+
->args([
21+
service('http_client')->ignoreOnInvalid(),
22+
service('translation.loader.xliff_raw'),
23+
param('kernel.default_locale')
24+
])
25+
->abstract()
26+
27+
->set('translation.remote_factory.loco', LocoRemoteFactory::class)
28+
->args([service('translator.data_collector')])
29+
->parent('translation.remote_factory.abstract')
30+
->tag('translation.remote_factory')
31+
;
32+
};

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_remotes.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_remotes.xml
-18Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.