Skip to content

[FrameworkBundle] Fix translations dir discovery #16139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both path exists in 2.3, but only one contains every translation files :/
So in 2.3, only /../Resources/translations will be loaded, which only contains az and he translations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, we have the new path in 2.3 with only incomplete files ? This looks wrong to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sorry, I merged really to quickly... let's try again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ogizanagi can you please work on this? (removing Resources/translations from Security/Core in 2.3 also)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I did not notice that translations are contained in both directories (even if not both are complete). I guess the real issue was caused by allowing to install symfony/security and symfony/security-core in parallel (see #16134) which led to the AuthenticationException being found first in the core package.

@nicolas-grekas Removing the translations from the core package means that we should use another class to detect the translations directory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh : Why ? We should only remove those translations files from 2.3 and use symfony/security Resources/translations folder.
Wouldn't be ok ? (it should not be propagated to upper branches)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #16141

// 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