[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('show_stylesheets', [Runtime::class, 'getShowStylesheets']),
|
||||
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;
|
||||
|
||||
use App\Core\Event;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Router\Router;
|
||||
use App\Entity\Actor;
|
||||
use App\Entity\Feed;
|
||||
|
@ -56,6 +57,11 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
|
|||
$this->request = $req;
|
||||
}
|
||||
|
||||
public function transchoice(array $message, int $count): string
|
||||
{
|
||||
return _m($message, ['count' => $count]);
|
||||
}
|
||||
|
||||
public function isCurrentRouteActive(string ...$routes): string
|
||||
{
|
||||
return $this->isCurrentRoute('active', ...$routes);
|
||||
|
|
Loading…
Reference in New Issue
Block a user