Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 64c1626

Browse filesBrowse files
Merge branch '4.3'
* 4.3: fix tests [Bridge\Twig] lazy load TranslatorTrait
2 parents 3c8aa87 + 38d8bdd commit 64c1626
Copy full SHA for 64c1626

File tree

Expand file treeCollapse file tree

2 files changed

+8
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-8
lines changed

‎src/Symfony/Bridge/Twig/Extension/TranslationExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Extension/TranslationExtension.php
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@
3333
*/
3434
class TranslationExtension extends AbstractExtension
3535
{
36-
use TranslatorTrait {
37-
getLocale as private;
38-
setLocale as private;
39-
trans as private doTrans;
40-
}
41-
4236
private $translator;
4337
private $translationNodeVisitor;
4438

@@ -115,7 +109,9 @@ public function trans($message, array $arguments = [], $domain = null, $locale =
115109
$arguments['%count%'] = $count;
116110
}
117111
if (null === $this->translator) {
118-
return $this->doTrans($message, $arguments, $domain, $locale);
112+
$this->translator = new class() implements TranslatorInterface {
113+
use TranslatorTrait;
114+
};
119115
}
120116

121117
return $this->translator->trans($message, $arguments, $domain, $locale);
@@ -127,8 +123,11 @@ public function trans($message, array $arguments = [], $domain = null, $locale =
127123
public function transchoice($message, $count, array $arguments = [], $domain = null, $locale = null)
128124
{
129125
if (null === $this->translator) {
130-
return $this->doTrans($message, array_merge(['%count%' => $count], $arguments), $domain, $locale);
126+
$this->translator = new class() implements TranslatorInterface {
127+
use TranslatorTrait;
128+
};
131129
}
130+
132131
if ($this->translator instanceof TranslatorInterface) {
133132
return $this->translator->trans($message, array_merge(['%count%' => $count], $arguments), $domain, $locale);
134133
}

‎src/Symfony/Component/Translation/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/composer.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"symfony/dependency-injection": "~3.4|~4.0",
2727
"symfony/http-kernel": "~3.4|~4.0",
2828
"symfony/intl": "~3.4|~4.0",
29+
"symfony/service-contracts": "^1.1.2",
2930
"symfony/var-dumper": "~3.4|~4.0",
3031
"symfony/yaml": "~3.4|~4.0",
3132
"symfony/finder": "~2.8|~3.0|~4.0",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.