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

Commitd4ab6f7

Browse files
[Contracts] Add Translation\TranslatorInterface + decouple symfony/validator from symfony/translation
1 parentf0168e3 commitd4ab6f7

File tree

61 files changed

+1046
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1046
-204
lines changed

‎UPGRADE-4.2.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,15 @@ Serializer
117117

118118
* Relying on the default value (false) of the "as_collection" option is deprecated since 4.2.
119119
You should set it to false explicitly instead as true will be the default value in 5.0.
120+
121+
Translation
122+
-----------
123+
124+
* The`TranslatorInterface` has been deprecated in favor of`Symfony\Contracts\Translation\TranslatorInterface`
125+
* The`MessageSelector`,`Interval` and`PluralizationRules` classes have been deprecated, use`IdentityTranslator` instead
126+
127+
Validator
128+
---------
129+
130+
* The component is now decoupled from`symfony/translation` and uses`Symfony\Contracts\Translation\TranslatorInterface` instead
131+
* The`ValidatorBuilderInterface` has been deprecated and`ValidatorBuilder` made final

‎UPGRADE-5.0.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ Translation
145145

146146
* The `FileDumper::setBackup()` method has been removed.
147147
* The `TranslationWriter::disableBackup()` method has been removed.
148+
* The `TranslatorInterface` has been removed in favor of `Symfony\Contracts\Translation\TranslatorInterface`
149+
* The `MessageSelector`, `Interval` and `PluralizationRules` classes have been removed, use `IdentityTranslator` instead
148150

149151
TwigBundle
150152
----------
@@ -157,6 +159,8 @@ Validator
157159
* The `Email::__construct()` 'strict' property has been removed. Use 'mode'=>"strict" instead.
158160
* Calling `EmailValidator::__construct()` method with a boolean parameter has been removed, use `EmailValidator("strict")` instead.
159161
* Removed the `checkDNS` and `dnsMessage` options from the `Url` constraint.
162+
* The component is now decoupled from `symfony/translation` and uses `Symfony\Contracts\Translation\TranslatorInterface` instead
163+
* The `ValidatorBuilderInterface` has been removed and `ValidatorBuilder` is now final
160164

161165
Workflow
162166
--------

‎src/Symfony/Bridge/Twig/Extension/TranslationExtension.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
useSymfony\Bridge\Twig\TokenParser\TransChoiceTokenParser;
1717
useSymfony\Bridge\Twig\TokenParser\TransDefaultDomainTokenParser;
1818
useSymfony\Bridge\Twig\TokenParser\TransTokenParser;
19-
useSymfony\Component\Translation\TranslatorInterface;
19+
useSymfony\Contracts\Translation\TranslatorInterface;
2020
useTwig\Extension\AbstractExtension;
2121
useTwig\NodeVisitor\NodeVisitorInterface;
2222
useTwig\TokenParser\AbstractTokenParser;

‎src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/StubTranslator.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespaceSymfony\Bridge\Twig\Tests\Extension\Fixtures;
1313

14-
useSymfony\Component\Translation\TranslatorInterface;
14+
useSymfony\Contracts\Translation\TranslatorInterface;
1515

1616
class StubTranslatorimplements TranslatorInterface
1717
{

‎src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
useSymfony\Bridge\Twig\Extension\TranslationExtension;
1616
useSymfony\Bridge\Twig\Translation\TwigExtractor;
1717
useSymfony\Component\Translation\MessageCatalogue;
18+
useSymfony\Contracts\Translation\TranslatorInterface;
1819
useTwig\Environment;
1920
useTwig\Error\Error;
2021
useTwig\Loader\ArrayLoader;
@@ -33,7 +34,7 @@ public function testExtract($template, $messages)
3334
'cache' =>false,
3435
'autoescape' =>false,
3536
));
36-
$twig->addExtension(newTranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock()));
37+
$twig->addExtension(newTranslationExtension($this->getMockBuilder(TranslatorInterface::class)->getMock()));
3738

3839
$extractor =newTwigExtractor($twig);
3940
$extractor->setPrefix('prefix');
@@ -82,7 +83,7 @@ public function getExtractData()
8283
publicfunctiontestExtractSyntaxError($resources)
8384
{
8485
$twig =newEnvironment($this->getMockBuilder('Twig\Loader\LoaderInterface')->getMock());
85-
$twig->addExtension(newTranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock()));
86+
$twig->addExtension(newTranslationExtension($this->getMockBuilder(TranslatorInterface::class)->getMock()));
8687

8788
$extractor =newTwigExtractor($twig);
8889

@@ -124,7 +125,7 @@ public function testExtractWithFiles($resource)
124125
'cache' =>false,
125126
'autoescape' =>false,
126127
));
127-
$twig->addExtension(newTranslationExtension($this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')->getMock()));
128+
$twig->addExtension(newTranslationExtension($this->getMockBuilder(TranslatorInterface::class)->getMock()));
128129

129130
$extractor =newTwigExtractor($twig);
130131
$catalogue =newMessageCatalogue('en');

‎src/Symfony/Bridge/Twig/composer.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"symfony/polyfill-intl-icu":"~1.0",
3030
"symfony/routing":"~3.4|~4.0",
3131
"symfony/templating":"~3.4|~4.0",
32-
"symfony/translation":"~3.4|~4.0",
32+
"symfony/translation":"~4.2",
3333
"symfony/yaml":"~3.4|~4.0",
3434
"symfony/security":"~3.4|~4.0",
3535
"symfony/security-acl":"~2.8|~3.0",
@@ -41,8 +41,9 @@
4141
"symfony/workflow":"~3.4|~4.0"
4242
},
4343
"conflict": {
44+
"symfony/console":"<3.4",
4445
"symfony/form":"<4.1.2",
45-
"symfony/console":"<3.4"
46+
"symfony/translation":"<4.2"
4647
},
4748
"suggest": {
4849
"symfony/finder":"",

‎src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
useSymfony\Component\DependencyInjection\ServiceSubscriberInterface;
1616
useSymfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
1717
useSymfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
18-
useSymfony\Component\Translation\TranslatorInterface;
18+
useSymfony\Contracts\Translation\TranslatorInterface;
1919

2020
/**
2121
* Generates the catalogues for translations.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
useSymfony\Component\Translation\MessageCatalogue;
2727
useSymfony\Component\Translation\Reader\TranslationReaderInterface;
2828
useSymfony\Component\Translation\Translator;
29-
useSymfony\Component\Translation\TranslatorInterface;
29+
useSymfony\Contracts\Translation\TranslatorInterface;
3030

3131
/**
3232
* Helps finding unused or missing translation messages in a given locale

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/LoggingTranslatorPass.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
useSymfony\Component\DependencyInjection\ContainerBuilder;
1616
useSymfony\Component\DependencyInjection\Exception\InvalidArgumentException;
1717
useSymfony\Component\Translation\TranslatorBagInterface;
18-
useSymfony\Component\Translation\TranslatorInterface;
18+
useSymfony\Contracts\Translation\TranslatorInterface;
1919

2020
/**
2121
* @author Abdellatif Ait boudad <a.aitboudad@gmail.com>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
useSymfony\Component\Stopwatch\Stopwatch;
9292
useSymfony\Component\Translation\Command\XliffLintCommandasBaseXliffLintCommand;
9393
useSymfony\Component\Translation\Translator;
94+
useSymfony\Component\Translation\Util\XliffUtils;
9495
useSymfony\Component\Validator\ConstraintValidatorInterface;
9596
useSymfony\Component\Validator\ObjectInitializerInterface;
9697
useSymfony\Component\WebLink\HttpHeaderSerializer;
@@ -966,6 +967,10 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
966967

967968
$loader->load('translation.xml');
968969

970+
if (!\class_exists(XliffUtils::class)) {
971+
$container->getDefinition('translator.formatter.default')->replaceArgument(0,newReference('translator.selector'));
972+
}
973+
969974
// Use the "real" translator instead of the identity default
970975
$container->setAlias('translator','translator.default')->setPublic(true);
971976
$container->setAlias('translator.formatter',newAlias($config['formatter'],false));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp