Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 96c2dd5

Browse files
committed
Fix translation function for poedit
1 parent ecddc52 commit 96c2dd5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/TwigTranslationExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(TranslatorInterface $translator)
3838
public function getFilters(): array
3939
{
4040
return [
41-
new TwigFilter('__', [$this, 'translate']),
41+
new TwigFilter('__', [$this, '__']),
4242
];
4343
}
4444

@@ -47,7 +47,7 @@ public function getFilters(): array
4747
*/
4848
public function getFunctions(): array
4949
{
50-
$twigFunction = new TwigFunction('__', [$this, 'translate']);
50+
$twigFunction = new TwigFunction('__', [$this, '__']);
5151
$twigFunction->setArguments([]);
5252

5353
return [$twigFunction];
@@ -58,7 +58,7 @@ public function getFunctions(): array
5858
*
5959
* @return mixed
6060
*/
61-
public function translate()
61+
public function __()
6262
{
6363
$args = func_get_args();
6464
$parameters = array_slice($args, 1);

tests/TwigTranslationExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testFilters()
5353
public function testTranslate(): void
5454
{
5555
$extension = $this->newExtensionInstance();
56-
$this->assertSame('a', $extension->translate('a'));
56+
$this->assertSame('a', $extension->__('a'));
5757
}
5858

5959
/**

0 commit comments

Comments
 (0)