Skip to content

Commit 308e6f5

Browse files
committed
[FrameworkBundle][Translation] allow register custom resources paths.
1 parent 862bdf1 commit 308e6f5

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,17 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode)
575575
->info('translator configuration')
576576
->canBeEnabled()
577577
->fixXmlConfig('fallback')
578+
->fixXmlConfig('path')
578579
->children()
579580
->arrayNode('fallbacks')
580581
->beforeNormalization()->ifString()->then(function ($v) { return array($v); })->end()
581582
->prototype('scalar')->end()
582583
->defaultValue(array('en'))
583584
->end()
585+
->arrayNode('paths')
586+
->defaultValue(array())
587+
->prototype('scalar')->end()
588+
->end()
584589
->booleanNode('logging')->defaultValue($this->debug)->end()
585590
->end()
586591
->end()

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,13 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
661661

662662
// Discover translation directories
663663
$dirs = array();
664+
665+
foreach ($config['paths'] as $path) {
666+
if (is_dir($path)) {
667+
$dirs[] = $path;
668+
}
669+
}
670+
664671
if (class_exists('Symfony\Component\Validator\Validation')) {
665672
$r = new \ReflectionClass('Symfony\Component\Validator\Validation');
666673

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
<xsd:complexType name="translator">
184184
<xsd:sequence>
185185
<xsd:element name="fallback" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
186+
<xsd:element name="path" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
186187
</xsd:sequence>
187188
<xsd:attribute name="enabled" type="xsd:boolean" />
188189
<xsd:attribute name="fallback" type="xsd:string" />

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ protected static function getBundleDefaultConfig()
146146
'enabled' => false,
147147
'fallbacks' => array('en'),
148148
'logging' => true,
149+
'paths' => array(),
149150
),
150151
'validation' => array(
151152
'enabled' => false,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy