public static
string
|
#
setLocale( string $locale, boolean $phpSetLocale = true )
Switches the current locale.
Switches the current locale.
Parameters
- $locale
- The new locale
- $phpSetLocale
- When TRUE, php function setlocale() will be called
Returns
string The last locale
|
|
public static
string
|
#
getLocale( )
Returns the current locale, e.g. de_de.
Returns the current locale, e.g. de_de.
Returns
string The current locale
|
|
public static
string
|
#
getLanguage( )
Returns the current language, e.g. "de".
Returns the current language, e.g. "de".
Returns
string The current language
|
|
public static
|
#
addDirectory( string $dir )
Adds a directory with lang files.
Adds a directory with lang files.
Parameters
- $dir
- Path to the directory
|
|
public static
string
|
#
msg( string $key )
Returns the translation htmlspecialchared for the given key.
Returns the translation htmlspecialchared for the given key.
Parameters
Returns
string Translation for the key
|
|
public static
string
|
#
rawMsg( string $key )
Returns the translation for the given key.
Returns the translation for the given key.
Parameters
Returns
string Translation for the key
|
|
public static
string
|
#
msgInLocale( string $key, string $locale )
Returns the translation htmlspecialchared for the given key and locale.
Returns the translation htmlspecialchared for the given key and locale.
Parameters
- $key
- A Language-Key
- $locale
- A Locale
Returns
string Translation for the key
|
|
public static
string
|
#
rawMsgInLocale( string $key, string $locale )
Returns the translation for the given key and locale.
Returns the translation for the given key and locale.
Parameters
- $key
- A Language-Key
- $locale
- A Locale
Returns
string Translation for the key
|
|
public static
boolean
|
#
hasMsg( string $key )
Checks if there is a translation for the given key.
Checks if there is a translation for the given key.
Parameters
Returns
boolean TRUE on success, else FALSE
|
|
public static
boolean
|
#
hasMsgOrFallback( string $key )
Checks if there is a translation for the given key in current language or any
fallback language.
Checks if there is a translation for the given key in current language or any
fallback language.
Parameters
Returns
boolean TRUE on success, else FALSE
|
|
public static
|
#
addMsg( string $key, string $msg )
Adds a new translation to the catalogue.
Adds a new translation to the catalogue.
Parameters
- $key
- Key
- $msg
- Message for the key
|
|
public static
array
|
#
getLocales( )
Returns the locales.
Returns
array Array of 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.
Translates the $text, if it begins with 'translate:', else it returns
$text.
Parameters
- $text
- The text for translation
- $use_htmlspecialchars
- Flag whether the translated text should be passed to htmlspecialchars()
- $i18nFunction
- Function that returns the translation for the i18n key
Returns
string Translated text
Throws
InvalidArgumentException InvalidArgumentException
|
|
public static
mixed
|
#
translateArray( mixed $array, boolean $use_htmlspecialchars = true, callable $i18nFunction = null )
Translates all array elements.
Translates all array elements.
Parameters
- $array
- The Array of Strings for translation
- $use_htmlspecialchars
- Flag whether the translated text should be passed to htmlspecialchars()
- $i18nFunction
- Function that returns the translation for the i18n key
Returns
mixed mixed
Throws
InvalidArgumentException InvalidArgumentException
|
|