Language class

The following sections explain each method of the class.

set_language


public static void set_language ( string $lng)

Sets the user language in the system

Parameter list
lng

The language like for example de_DE for German in the German space or en_US for American English.

Warning: It should be noted that the proper locale is installed on the server.


get_language


public static string get_language ( )

Returns the currently set user language.


set_language_path


public static void set_language_path ( string $path )

The path for the language folders. Each language code must have a folder. This folder, in turn, is a the LC_MESSAGES folder called. And then in there are the language abbreviation .mo and .po files.

Parameter list
path

The absolute path to the locale folders


get_language_path


public static string get_language_path ( )

Returns the absolute path back to the locale language folders.


set_default_language


public static void set_default_language ( string $lng)

Sets the system default locale.

Parameter list
lng

The locale language code.


get_default_language


public static string get_default_language ( )

Returns the default locale language code back.


load_lang


public static void load_lang ( )

If carried out to initialize the languages. Here locales and folders are set.


translate


public static string translate( string $text)

Translated the given string for the current locale. Here, the term has in the locale .po occur file.

Parameter list
text

The string to be translated to the current locale. If the string in the .po file not found, it returns the given string untouched.


getAllSystemLocales


public static array getAllSystemLocales( )

Are all locales back that are installed on the server.

Note: Only works on UNIX systems. Windows systems do not support the reading of the locales.