Skip to content

Commit ea10f24

Browse files
minor #16139 [FrameworkBundle] Fix translations dir discovery (nicolas-grekas)
This PR was merged into the 2.3 branch. Discussion ---------- [FrameworkBundle] Fix translations dir discovery | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16133 | License | MIT | Doc PR | - Commits ------- f37ceef [FrameworkBundle] Fix translations dir discovery
2 parents 59d8220 + f37ceef commit ea10f24

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -553,16 +553,16 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
553553
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
554554
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
555555

556-
$legacyTranslationsDir = dirname($r->getFilename()).'/../../Resources/translations';
556+
// with Symfony 2.4, the Security component was split into several subpackages
557+
// and the translations have been moved to the symfony/security-core package
558+
$translationsDir = dirname($r->getFilename()).'/../Resources/translations';
557559

558-
if (file_exists($legacyTranslationsDir)) {
560+
if (!file_exists($translationsDir) && file_exists($dir = dirname($r->getFilename()).'/../../Resources/translations')) {
559561
// in Symfony 2.3, translations are located in the symfony/security package
560-
$dirs[] = $legacyTranslationsDir;
561-
} else {
562-
// with Symfony 2.4, the Security component was split into several subpackages
563-
// and the translations have been moved to the symfony/security-core package
564-
$dirs[] = dirname($r->getFilename()).'/../Resources/translations';
562+
$translationsDir = $dir;
565563
}
564+
565+
$dirs[] = $translationsDir;
566566
}
567567
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
568568
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {

0 commit comments

Comments
 (0)