2011-05-15 01:32:47 +02:00
|
|
|
<?php
|
|
|
|
|
2011-05-15 03:56:54 +02:00
|
|
|
if (isset($_GET['lang']) && is_string($_GET['lang']) && in_array($_GET['lang'], array_keys($ALLOWED_LANGUAGES)) ) {
|
2011-05-15 01:32:47 +02:00
|
|
|
$mlocale = $_GET['lang'] ;
|
|
|
|
setcookie('lang' , $_GET['lang'], time()+60*5);
|
2011-05-15 03:56:54 +02:00
|
|
|
} elseif ( isset($_COOKIE['lang']) && is_string($_COOKIE['lang']) && in_array($_COOKIE['lang'], array_keys($ALLOWED_LANGUAGES)) ) {
|
2011-05-15 01:32:47 +02:00
|
|
|
$mlocale = $_COOKIE['lang'] ;
|
2011-05-15 03:56:54 +02:00
|
|
|
} else {
|
|
|
|
$mlocale = LANGUE ;
|
2011-05-15 01:32:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$locale = $mlocale . '.utf8';
|
2013-03-04 18:55:13 +01:00
|
|
|
putenv('LANGUAGE=');
|
2011-05-15 01:32:47 +02:00
|
|
|
setlocale(LC_ALL, $locale);
|
|
|
|
setlocale(LC_TIME, $locale);
|
|
|
|
setlocale(LC_MESSAGES, $locale);
|
|
|
|
|
|
|
|
$domain = 'Studs';
|
|
|
|
bindtextdomain($domain, 'locale');
|
|
|
|
bind_textdomain_codeset($domain, 'UTF-8');
|
|
|
|
textdomain($domain);
|
|
|
|
|
|
|
|
/* temp, for compatibility :*/
|
|
|
|
$a = explode('_', $locale);
|
2013-03-04 18:55:13 +01:00
|
|
|
$_SESSION['langue'] = strtoupper($a[0]);
|
2014-06-11 19:19:17 +02:00
|
|
|
|
|
|
|
/* <html lang="$lang"> */
|
|
|
|
$lang = ($_SESSION['langue']!='') ? strtolower($_SESSION['langue']) : 'fr';
|
|
|
|
|