LocalizationUtility

Localization helper which should be used to fetch localized labels.

Table of Contents

Methods

translate()  : string|null
Returns the localized label of the LOCAL_LANG key, $key.
buildLanguageService()  : LanguageService
getLanguageFilePath()  : string
Returns the default path and filename for an extension
getLocale()  : Locale
Resolves the currently active locale.
getPluginName()  : string
Allow plugin.tx_myextension._LOCAL_LANG and plugin.tx_myextension_myplugin._LOCAL_LANG
getRuntimeCache()  : FrontendInterface

Methods

translate()

Returns the localized label of the LOCAL_LANG key, $key.

public static translate(string $key[, string|null $extensionName = null ][, array<string|int, mixed>|null $arguments = null ][, Locale|string|null $languageKey = null ][, ServerRequestInterface|null $request = null ]) : string|null
Parameters
$key : string

The key from the LOCAL_LANG array for which to return the value.

$extensionName : string|null = null

The name of the extension

$arguments : array<string|int, mixed>|null = null

The arguments of the extension, being passed over to sprintf

$languageKey : Locale|string|null = null

The language key or null for using the current language from the system

$request : ServerRequestInterface|null = null
Return values
string|null

The value from LOCAL_LANG or null if no translation was found.

getLanguageFilePath()

Returns the default path and filename for an extension

protected static getLanguageFilePath(string $extensionName) : string
Parameters
$extensionName : string
Return values
string

getLocale()

Resolves the currently active locale.

protected static getLocale(Locale|string|null $localeOrLanguageKey) : Locale

Using the Locales factory, as it handles dependencies (e.g. "de-AT" falls back to "de").

Parameters
$localeOrLanguageKey : Locale|string|null
Return values
Locale

getPluginName()

Allow plugin.tx_myextension._LOCAL_LANG and plugin.tx_myextension_myplugin._LOCAL_LANG

protected static getPluginName([ServerRequestInterface|null $request = null ]) : string
Parameters
$request : ServerRequestInterface|null = null
Return values
string

        
On this page

Search results