-
Notifications
You must be signed in to change notification settings - Fork 82
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
Passing "null" as the $locale argument to Symfony\Component\Translation\Translator::setLocale() is deprecated since Symfony 4.4 #173
Comments
I didn't analyze code of Translator but maybe it is possible to add default locale from config to constructor of Translator and use it at line 100. |
…mfony\Component\Translation\Translator::setLocale() is deprecated since Symfony 4.4 *issue - Kdyby#173
…mfony\Component\Translation\Translator::setLocale() is deprecated since Symfony 4.4 *issue - Kdyby#173
I made some changes which should fixed this issue (don't allow to set locale as null in parent class). But really didn't analyze code of Translator at all so I can not say that this is the right way how to solve it (for me not, because why to allow null in child class when parent don't allow it now - it should be removed). |
There is another related issue with current Symphony. Method Translator::getLocale() never returns public function getLocale()
{
if (empty(parent::getLocale())) {
$this->setLocale($this->localeResolver->resolve($this));
}
return parent::getLocale();
} should be changed to something like: public function getLocale()
{
if (!$this->localeResolved) {
$this->setLocale($this->localeResolver->resolve($this));
$this->localeResolved = true;
}
return parent::getLocale();
} Without this change, language resolving doesn't work at all. |
The text was updated successfully, but these errors were encountered: