Class rex_i18n

Class for internationalization.

Package: redaxo\core
Located at redaxo/src/core/lib/util/i18n.php

Methods summary

public static string
# setLocale( string $locale, boolean $phpSetLocale = true )

Switches the current locale.

public static string
# getLocale( )

Returns the current locale, e.g. de_de.

public static string
# getLanguage( )

Returns the current language, e.g. "de".

public static
# addDirectory( string $dir )

Adds a directory with lang files.

public static string
# msg( string $key )

Returns the translation htmlspecialchared for the given key.

public static string
# rawMsg( string $key )

Returns the translation for the given key.

public static string
# msgInLocale( string $key, string $locale )

Returns the translation htmlspecialchared for the given key and locale.

public static string
# rawMsgInLocale( string $key, string $locale )

Returns the translation for the given key and locale.

public static boolean
# hasMsg( string $key )

Checks if there is a translation for the given key.

public static boolean
# hasMsgOrFallback( string $key )

Checks if there is a translation for the given key in current language or any fallback language.

public static
# addMsg( string $key, string $msg )

Adds a new translation to the catalogue.

public static array
# getLocales( )

Returns the locales.

public static string
# translate( string $text, boolean $use_htmlspecialchars = true, callable $i18nFunction = null )

Translates the $text, if it begins with 'translate:', else it returns $text.

public static mixed
# translateArray( mixed $array, boolean $use_htmlspecialchars = true, callable $i18nFunction = null )

Translates all array elements.