DigiComp.FlowTranslationEnd.../Classes/ViewHelpers/CurrentHtmlLangViewHelper.php

33 lines
699 B
PHP
Raw Normal View History

2023-08-05 15:49:46 +02:00
<?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());
}
}