Open xsuchy09 opened 4 years ago
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.
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 null
. So the method:
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.