-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
[RTM] Improve the locale handling #1064
Conversation
|
|
||
| $finder = Finder::create()->directories()->depth(0)->in($dirs); | ||
|
|
||
| $languages = array_values( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$languages = [$this->defaultLocale];
foreach ($finder as $file) {
if (preg_match('/^[a-z]{2}(_[A-Z]{2})?$/', $file->getFilename())) {
$languages[] = $file->getFilename();
}
}
return array_values(array_unique($languages));There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 6bcce67.
| $finder = Finder::create()->directories()->depth(0)->in($dirs); | ||
|
|
||
| foreach ($finder as $file) { | ||
| if (preg_match('/^[a-z]{2}(_[A-Z]{2})?$/', $file->getFilename())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't the $finder do that already? Like so:
$finder = Finder::create()->directories()->depth(0)->in($dirs)->name('/^[a-z]{2}(_[A-Z]{2})?$/');There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 4f35589.
| @@ -51,7 +51,8 @@ public function getConfiguration(array $config, ContainerBuilder $container) | |||
|
|
|||
| return new Configuration( | |||
| $container->getParameter('kernel.debug'), | |||
| $container->getParameter('kernel.project_dir') | |||
| $container->getParameter('kernel.project_dir'), | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be kernel.root_dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in be52c2c.
|
Merged in b40a935. |
This PR caches the installed languages in the DI container, so we do not need to iterate over the file system upon every request. Also, it no longer stores the locale in the session by default, which is now done in the
setUserFromDb()method.