TranslateViewHelper extends AbstractViewHelper
This class is the implementation of a Fluid ViewHelper.
View this class in the TYPO3 ViewHelper reference: <f:translate>
FinalYes
ViewHelper to provide a translation for language keys ("locallang"/"LLL").
By default, the files are loaded from the folder Resources/Private/Language/
.
Placeholder substitution (like PHP's sprintf()
) can be evaluated when provided as
arguments
attribute.
<f:translate key="LLL:EXT:myext/Resources/Private/Language/locallang.xlf:key1" />
<f:translate key="someKey" arguments="{0: 'dog', 'fox'}" />
Tags
Table of Contents
Properties
- $escapeChildren : bool
- Output is escaped already. We must not escape children, to avoid double encoding.
Methods
- initializeArguments() : void
- render() : string
- Return array element by key.
- getUsedLocale() : Locale|string|null
- handleDefaultValue() : string
- Ensure that a string is returned, if the underlying logic returns null, or cannot handle a translation
Properties
$escapeChildren
Output is escaped already. We must not escape children, to avoid double encoding.
protected
bool
$escapeChildren
= false
Methods
initializeArguments()
public
initializeArguments() : void
render()
Return array element by key.
public
render() : string
Tags
Return values
stringgetUsedLocale()
protected
static getUsedLocale(Locale|string|null $languageKey, ServerRequestInterface|null $request) : Locale|string|null
Parameters
- $languageKey : Locale|string|null
- $request : ServerRequestInterface|null
Return values
Locale|string|nullhandleDefaultValue()
Ensure that a string is returned, if the underlying logic returns null, or cannot handle a translation
protected
static handleDefaultValue(string $default, array<string|int, mixed>|null $translateArguments) : string
Parameters
- $default : string
- $translateArguments : array<string|int, mixed>|null