DigiComp.FlowTranslationEnd.../Classes/ViewHelpers/CurrentHtmlLangViewHelper.php
Ferdinand Kuhl 5a073ce6b9
All checks were successful
ci/woodpecker/push/code-style Pipeline was successful
ci/woodpecker/push/functional-tests Pipeline was successful
First version, extracted and tested
2023-08-05 15:58:50 +02:00

32 lines
699 B
PHP

<?php
declare(strict_types=1);
namespace DigiComp\FlowTranslationEndpoint\ViewHelpers;
use Neos\Flow\I18n\Service as I18nService;
use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper;
class CurrentHtmlLangViewHelper extends AbstractViewHelper
{
/**
* @var I18nService
*/
protected I18nService $i18nService;
/**
* @param I18nService $i18nService
*/
public function __construct(I18nService $i18nService)
{
$this->i18nService = $i18nService;
}
/**
* @return string
*/
public function render(): string
{
return \str_replace('_', '-', (string)$this->i18nService->getConfiguration()->getCurrentLocale());
}
}