language : allow to force the language from anoter source than the cookie and the browser params
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2509 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -279,7 +279,6 @@ class language
|
|||||||
putenv ('LANG='.$languageCode.'.'.$codeset);
|
putenv ('LANG='.$languageCode.'.'.$codeset);
|
||||||
putenv ('LANGUAGE='.$languageCode.'.'.$codeset);
|
putenv ('LANGUAGE='.$languageCode.'.'.$codeset);
|
||||||
$GLOBALS["domframework"]["lang"] = $languageCode;
|
$GLOBALS["domframework"]["lang"] = $languageCode;
|
||||||
|
|
||||||
bind_textdomain_codeset ($package, "utf-8");
|
bind_textdomain_codeset ($package, "utf-8");
|
||||||
bindtextdomain ($package, $repLocale);
|
bindtextdomain ($package, $repLocale);
|
||||||
textdomain ($package);
|
textdomain ($package);
|
||||||
@@ -301,14 +300,18 @@ class language
|
|||||||
/** The complete stack of language selection
|
/** The complete stack of language selection
|
||||||
@param string $package The package name (package.(po|mo) files)
|
@param string $package The package name (package.(po|mo) files)
|
||||||
@param string $languageCookie The name of the cookie saved in the browser
|
@param string $languageCookie The name of the cookie saved in the browser
|
||||||
|
@param string $forcedLanguage The name of a forced language
|
||||||
@return string The language with format fr_FR to be used */
|
@return string The language with format fr_FR to be used */
|
||||||
public function activeLanguage ($package, $languageCookie)
|
public function activeLanguage ($package, $languageCookie,
|
||||||
|
$forcedLanguage = null)
|
||||||
{
|
{
|
||||||
// Prefered language in the browser
|
// Prefered language in the browser
|
||||||
$langNav = $this->languageSelection ("./locale", "fr_FR");
|
$langNav = $this->languageSelection ("./locale", "fr_FR");
|
||||||
// Language defined in the cookie
|
// Language defined in the cookie
|
||||||
$langCookie = $this->languageCookie ($languageCookie);
|
$langCookie = $this->languageCookie ($languageCookie);
|
||||||
if ($langCookie !== FALSE)
|
if ($forcedLanguage !== null)
|
||||||
|
$languageCode = $forcedLanguage;
|
||||||
|
elseif ($langCookie !== FALSE)
|
||||||
$languageCode = $langCookie;
|
$languageCode = $langCookie;
|
||||||
else
|
else
|
||||||
$languageCode = $langNav;
|
$languageCode = $langNav;
|
||||||
|
|||||||
Reference in New Issue
Block a user