LocalizationUtility (Extbase)

This class is used to translate strings within Extbase context. For an example see Localization in Extbase.

class TYPO3\CMS\Extbase\Utility\LocalizationUtility

Localization helper which should be used to fetch localized labels.

translate(string $key, string $extensionName = NULL, array $arguments = NULL, TYPO3\\CMS\\Core\\Localization\\Locale|string|null $languageKey = NULL)

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

Parameters
  • $key (string) -- The key from the LOCAL_LANG array for which to return the value.

  • $extensionName (string) -- The name of the extension, default: NULL

  • $arguments (array) -- The arguments of the extension, being passed over to sprintf, default: NULL

  • $languageKey (TYPO3\CMS\Core\Localization\Locale|string|null) -- The language key or null for using the current language from the system, default: NULL

Return type

string

Returns

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