Skip to content

Commit

Permalink
[FrameworkBundle] removed translator.fallback_locale parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 30, 2011
1 parent 40606ed commit 68d340b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
Expand Up @@ -255,7 +255,7 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode)
->canBeUnset()
->children()
->booleanNode('enabled')->defaultTrue()->end()
->scalarNode('fallback')->end()
->scalarNode('fallback')->defaultValue('en')->end()
->end()
->end()
->end()
Expand Down
Expand Up @@ -416,7 +416,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
{
if (!empty($config['enabled'])) {
// Use the "real" translator instead of the identity default
$container->setDefinition('translator', $container->findDefinition('translator.real'));
$container->setDefinition('translator', $translator = $container->findDefinition('translator.real'));
$translator->addMethodCall('setFallbackLocale', array($config['fallback']));

// Discover translation directories
$dirs = array();
Expand Down Expand Up @@ -444,10 +445,6 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
}
$container->setParameter('translation.resources', $resources);
}

if (isset($config['fallback'])) {
$container->setParameter('translator.fallback_locale', $config['fallback']);
}
}

/**
Expand Down
Expand Up @@ -11,7 +11,6 @@
<parameter key="translation.loader.php.class">Symfony\Component\Translation\Loader\PhpFileLoader</parameter>
<parameter key="translation.loader.yml.class">Symfony\Component\Translation\Loader\YamlFileLoader</parameter>
<parameter key="translation.loader.xliff.class">Symfony\Component\Translation\Loader\XliffFileLoader</parameter>
<parameter key="translator.fallback_locale">en</parameter>
</parameters>

<services>
Expand All @@ -23,7 +22,6 @@
<argument key="debug">%kernel.debug%</argument>
</argument>
<argument type="service" id="session" on-invalid="ignore" />
<call method="setFallbackLocale"><argument>%translator.fallback_locale%</argument></call>
</service>

<service id="translator" class="%translator.identity.class%">
Expand Down
Expand Up @@ -131,7 +131,8 @@ public function testTranslator()
'->registerTranslatorConfiguration() finds FrameworkExtension translation resources'
);

$this->assertEquals('fr', $container->getParameter('translator.fallback_locale'));
$calls = $container->getDefinition('translator.real')->getMethodCalls();
$this->assertEquals('fr', $calls[0][1][0]);
}

/**
Expand Down

0 comments on commit 68d340b

Please sign in to comment.