Skip to content

Commit

Permalink
minor #16139 [FrameworkBundle] Fix translations dir discovery (nicola…
Browse files Browse the repository at this point in the history
…s-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
  • Loading branch information
nicolas-grekas committed Oct 6, 2015
2 parents 59d8220 + f37ceef commit ea10f24
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -553,16 +553,16 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');

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

if (file_exists($legacyTranslationsDir)) {
if (!file_exists($translationsDir) && file_exists($dir = dirname($r->getFilename()).'/../../Resources/translations')) {
// in Symfony 2.3, translations are located in the symfony/security package
$dirs[] = $legacyTranslationsDir;
} else {
// with Symfony 2.4, the Security component was split into several subpackages
// and the translations have been moved to the symfony/security-core package
$dirs[] = dirname($r->getFilename()).'/../Resources/translations';
$translationsDir = $dir;
}

$dirs[] = $translationsDir;
}
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
Expand Down

0 comments on commit ea10f24

Please sign in to comment.