Files
chill-bundles/src/Bundle/ChillMainBundle/Templating/TranslatableStringTwig.php
2025-11-03 16:22:33 +01:00

36 lines
800 B
PHP

<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Templating;
class TranslatableStringTwig
{
/**
* TranslatableStringTwig constructor.
*/
public function __construct(private readonly TranslatableStringHelper $helper) {}
/**
* Returns the name of the extension.
*/
public function getName(): string
{
return 'chill_main_localize';
}
#[\Twig\Attribute\AsTwigFilter('localize_translatable_string')]
public function localize(array $translatableStrings): ?string
{
return $this->helper
->localize($translatableStrings);
}
}