Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76b2ed4

Browse files
committed
moved validator translation files to the Form and Validator components to make them reusable (closes #4588)
1 parent f881d28 commit 76b2ed4

File tree

73 files changed

+685
-423
lines changed

Some content is hidden

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

73 files changed

+685
-423
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
2.1.0
55
-----
66

7+
* moved the translation files to the Form and Validator components
78
* changed the default extension for XLIFF files from .xliff to .xlf
89
* moved Symfony\Bundle\FrameworkBundle\ContainerAwareEventDispatcher to Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher
910
* moved Symfony\Bundle\FrameworkBundle\Debug\TraceableEventDispatcher to Symfony\Component\EventDispatcher\ContainerAwareTraceableEventDispatcher

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,16 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
543543
if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/translations')) {
544544
$dirs[] = $dir;
545545
}
546+
if (class_exists('Symfony\Component\Validator\Validator')) {
547+
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
548+
549+
$dirs[] = dirname($r->getFilename()).'/Resources/translations';
550+
}
551+
if (class_exists('Symfony\Component\Form\Form')) {
552+
$r = new \ReflectionClass('Symfony\Component\Form\Form');
553+
554+
$dirs[] = dirname($r->getFilename()).'/Resources/translations';
555+
}
546556

547557
// Register translation resources
548558
if ($dirs) {

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,16 @@ public function testTranslator()
183183
}
184184
}
185185

186+
$files = array_map(function($resource) use ($resources) { return str_replace(realpath(__DIR__.'/../../../../..').'/', '', realpath($resource[1])); }, $resources);
186187
$this->assertContains(
187-
realpath(__DIR__.'/../../Resources/translations/validators.fr.xlf'),
188-
array_map(function($resource) use ($resources) { return realpath($resource[1]); }, $resources),
189-
'->registerTranslatorConfiguration() finds FrameworkExtension translation resources'
188+
'Symfony/Component/Validator/Resources/translations/validators.en.xlf',
189+
$files,
190+
'->registerTranslatorConfiguration() finds Validator translation resources'
191+
);
192+
$this->assertContains(
193+
'Symfony/Component/Form/Resources/translations/validators.en.xlf',
194+
$files,
195+
'->registerTranslatorConfiguration() finds Form translation resources'
190196
);
191197

192198
$calls = $container->getDefinition('translator.default')->getMethodCalls();
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>Aquest formulari no hauria de contenir camps addicionals.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>L'arxiu pujat és massa gran. Per favor, pugi un arxiu més petit.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid.</source>
15+
<target>El token CSRF no és vàlid.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>Tato skupina polí nesmí obsahovat další pole.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>Nahraný soubor je příliš velký. Nahrajte prosím menší soubor.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
15+
<target>CSRF token je neplatný. Zkuste prosím znovu odeslat formulář.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>Feltgruppen må ikke indeholde ekstra felter.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>Den oploadede fil var for stor. Opload venligst en mindre fil.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid.</source>
15+
<target>CSRF nøglen er ugyldig.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>Dieses Formular sollte keine zusätzlichen Felder enthalten.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>Die hochgeladene Datei ist zu groß. Versuchen Sie bitte eine kleinere Datei hochzuladen.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
15+
<target>Das CSRF-Token ist ungültig. Versuchen Sie bitte das Formular erneut zu senden.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>This form should not contain extra fields.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>The uploaded file was too large. Please try to upload a smaller file.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
15+
<target>The CSRF token is invalid. Please try to resubmit the form.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>Este formulario no debería contener campos adicionales.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>El archivo subido es demasiado grande. Por favor, suba un archivo más pequeño.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid.</source>
15+
<target>El token CSRF no es válido.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version='1.0'?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="file.ext">
4+
<body>
5+
<trans-unit id="28">
6+
<source>This form should not contain extra fields.</source>
7+
<target>Väljade grupp ei tohiks sisalda lisaväljasid.</target>
8+
</trans-unit>
9+
<trans-unit id="29">
10+
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
11+
<target>Üleslaaditud fail oli liiga suur. Palun proovi uuesti väiksema failiga.</target>
12+
</trans-unit>
13+
<trans-unit id="30">
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
15+
<target>CSRF-märgis on vigane. Palun proovi vormi uuesti esitada.</target>
16+
</trans-unit>
17+
</body>
18+
</file>
19+
</xliff>

0 commit comments

Comments
 (0)