forked from GNUsocial/gnu-social
[TWIG] Implement transchoice for ICU plural translations
This commit is contained in:
parent
d4c908c194
commit
2f539d176d
@ -79,6 +79,7 @@ class Extension extends AbstractExtension
|
|||||||
new TwigFunction('open_details', [Runtime::class, 'openDetails']),
|
new TwigFunction('open_details', [Runtime::class, 'openDetails']),
|
||||||
new TwigFunction('show_stylesheets', [Runtime::class, 'getShowStylesheets']),
|
new TwigFunction('show_stylesheets', [Runtime::class, 'getShowStylesheets']),
|
||||||
new TwigFunction('add_right_panel_block', [Runtime::class, 'addRightPanelBlock']),
|
new TwigFunction('add_right_panel_block', [Runtime::class, 'addRightPanelBlock']),
|
||||||
|
new TwigFunction('transchoice', [Runtime::class, 'transchoice']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ declare(strict_types = 1);
|
|||||||
namespace App\Twig;
|
namespace App\Twig;
|
||||||
|
|
||||||
use App\Core\Event;
|
use App\Core\Event;
|
||||||
|
use function App\Core\I18n\_m;
|
||||||
use App\Core\Router\Router;
|
use App\Core\Router\Router;
|
||||||
use App\Entity\Actor;
|
use App\Entity\Actor;
|
||||||
use App\Entity\Feed;
|
use App\Entity\Feed;
|
||||||
@ -56,6 +57,11 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
|
|||||||
$this->request = $req;
|
$this->request = $req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function transchoice(array $message, int $count): string
|
||||||
|
{
|
||||||
|
return _m($message, ['count' => $count]);
|
||||||
|
}
|
||||||
|
|
||||||
public function isCurrentRouteActive(string ...$routes): string
|
public function isCurrentRouteActive(string ...$routes): string
|
||||||
{
|
{
|
||||||
return $this->isCurrentRoute('active', ...$routes);
|
return $this->isCurrentRoute('active', ...$routes);
|
||||||
|
Loading…
Reference in New Issue
Block a user