Skip to content

Commit

Permalink
Fix the default behaviour of TranslatorStub when a key is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasGuilloux committed Nov 18, 2021
1 parent 132fc75 commit 56be0ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Stubs/Symfony/TranslatorStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TranslatorStub implements TranslatorInterface
public function trans($id, array $parameters = [], $domain = null, $locale = null): string
{
if (!array_key_exists($id, $this->translations)) {
return '';
return $id;
}

$translation = $this->translations[$id];
Expand Down
2 changes: 1 addition & 1 deletion Tests/Stubs/TranslatorStubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ public function testAddGetTranslationsAndTranslateWithParameter(): void
public function testTranslateMissingKey(): void
{
$result = $this->translator->trans('key');
self::assertSame('', $result);
self::assertSame('key', $result);
}
}

0 comments on commit 56be0ca

Please sign in to comment.