Localization Utility

Shorthands for receiving and output translations.

class LocalizationUtility
Fully qualified name
\Jar\Utilities\Utilities\LocalizationUtility

loadTyposcriptTranslations ( $extension)

Loads the translations, set by _LOCAL_LANG from a extension.

param string $extension

Extension Key without the beginnining tx_

Example:

plugin.tx_myextension._LOCAL_LANG {
   default {
      hello = Hello
      world = World
   }
   de {
      hello = Hallo
   }
}
Copied!
LocalizationUtility::loadTyposcriptTranslations('myextension');
Copied!

returns

// in EN
[
   'hello' =>  'Hello',
   'world' =>  'World',
]

// in DE
[
   'hello' =>  'Hallo',
   'world' =>  'World',
]
Copied!
Returns

The translations.


getLanguageService ( )

Get the current Language Service.

Returns

The Language Service.


localize ( $input)

Localize a translation key to the translation value.

param string $input

The translation key.

Returns

The translation value or the translation key, when no translation is found.