Skip to content

Commit a624592

Browse files
Fix
1 parent 74e200a commit a624592

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/StubTranslator.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@
1111

1212
namespace Symfony\Bridge\Twig\Tests\Extension\Fixtures;
1313

14+
use Symfony\Contracts\Translation\TranslatableInterface;
1415
use Symfony\Contracts\Translation\TranslatorInterface;
1516

1617
class StubTranslator implements TranslatorInterface
1718
{
1819
public function trans($id, array $parameters = [], $domain = null, $locale = null): string
1920
{
21+
$parameters = array_map(
22+
static fn ($parameter) => $parameter instanceof TranslatableInterface ? $parameter->trans($this, $locale) : $parameter,
23+
$parameters
24+
);
25+
2026
return '[trans]'.strtr($id, $parameters).'[/trans]';
2127
}
2228

src/Symfony/Contracts/Translation/TranslatorTrait.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public function trans(?string $id, array $parameters = [], ?string $domain = nul
4141
return '';
4242
}
4343

44+
$parameters = array_map(
45+
static fn ($parameter) => $parameter instanceof TranslatableInterface ? $parameter->trans($this, $locale) : $parameter,
46+
$parameters
47+
);
48+
4449
if (!isset($parameters['%count%']) || !is_numeric($parameters['%count%'])) {
4550
return strtr($id, $parameters);
4651
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy