Back to the module list

Language selector

The user can define the interface language of a web application.

This module allow to choose the language to display by using the user prefs proposed by its browser and the application's translations available.

The selected choice can also be stored in a cookie to overwrite the automatic process

// Language
$language = new \language ();
// The application name is used to choose the
// locale/fr_FR.UTF8/LC_MESSAGES/application.po file.
// The second parameter is the cookie name.
$lang = $language->activeLanguage ("application", "application-Language");
// Define the default value if none can be automatically detected from the
// user preferences.
if ($lang === "C") $lang = "fr_FR";