Merge branch '4.3'
* 4.3: fix tests [Bridge\Twig] lazy load TranslatorTrait
This commit is contained in:
commit
64c162648a
@ -33,12 +33,6 @@ use Twig\TwigFilter;
|
||||
*/
|
||||
class TranslationExtension extends AbstractExtension
|
||||
{
|
||||
use TranslatorTrait {
|
||||
getLocale as private;
|
||||
setLocale as private;
|
||||
trans as private doTrans;
|
||||
}
|
||||
|
||||
private $translator;
|
||||
private $translationNodeVisitor;
|
||||
|
||||
@ -115,7 +109,9 @@ class TranslationExtension extends AbstractExtension
|
||||
$arguments['%count%'] = $count;
|
||||
}
|
||||
if (null === $this->translator) {
|
||||
return $this->doTrans($message, $arguments, $domain, $locale);
|
||||
$this->translator = new class() implements TranslatorInterface {
|
||||
use TranslatorTrait;
|
||||
};
|
||||
}
|
||||
|
||||
return $this->translator->trans($message, $arguments, $domain, $locale);
|
||||
@ -127,8 +123,11 @@ class TranslationExtension extends AbstractExtension
|
||||
public function transchoice($message, $count, array $arguments = [], $domain = null, $locale = null)
|
||||
{
|
||||
if (null === $this->translator) {
|
||||
return $this->doTrans($message, array_merge(['%count%' => $count], $arguments), $domain, $locale);
|
||||
$this->translator = new class() implements TranslatorInterface {
|
||||
use TranslatorTrait;
|
||||
};
|
||||
}
|
||||
|
||||
if ($this->translator instanceof TranslatorInterface) {
|
||||
return $this->translator->trans($message, array_merge(['%count%' => $count], $arguments), $domain, $locale);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
"symfony/dependency-injection": "~3.4|~4.0",
|
||||
"symfony/http-kernel": "~3.4|~4.0",
|
||||
"symfony/intl": "~3.4|~4.0",
|
||||
"symfony/service-contracts": "^1.1.2",
|
||||
"symfony/var-dumper": "~3.4|~4.0",
|
||||
"symfony/yaml": "~3.4|~4.0",
|
||||
"symfony/finder": "~2.8|~3.0|~4.0",
|
||||
|
Reference in New Issue
Block a user