From ca365ff34895f93dd06ee8c33b2ccb6eb395d357 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Fri, 2 Jan 2015 00:19:56 +0100 Subject: [PATCH] Fix the selected item on langs selection --- app/inc/i18n.php | 26 ++++++++++++-------------- app/inc/init.php | 17 +++++++++-------- bandeaux.php | 2 +- tpl/header.tpl | 4 ++-- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/app/inc/i18n.php b/app/inc/i18n.php index 829206c..447518f 100644 --- a/app/inc/i18n.php +++ b/app/inc/i18n.php @@ -37,14 +37,14 @@ if (isset($_POST['lang']) && is_string($_POST['lang']) && in_array($_POST['lang' } $locale = $mlocale . '.utf8';//unix format -if (strtoupper(substr(PHP_OS,0,3))=='WIN'){ - putenv("LC_ALL=$mlocale"); //Windows env. needed to switch between languages - switch ($mlocale){ - case 'fr_FR' : $locale = "fra";break; //$locale in windows locale format, needed to use php function that handle text : strftime() - case 'en_GB' : $locale = "english";break; //see http://msdn.microsoft.com/en-us/library/39cwe7zf%28v=vs.90%29.aspx - case 'de_DE' : $locale = "deu";break; - case 'es_ES' : $locale = "esp";break; - } +if (strtoupper(substr(PHP_OS,0,3))=='WIN'){ + putenv("LC_ALL=$mlocale"); //Windows env. needed to switch between languages + switch ($mlocale){ + case 'fr_FR' : $locale = "fra";break; //$locale in windows locale format, needed to use php function that handle text : strftime() + case 'en_GB' : $locale = "english";break; //see http://msdn.microsoft.com/en-us/library/39cwe7zf%28v=vs.90%29.aspx + case 'de_DE' : $locale = "deu";break; + case 'es_ES' : $locale = "esp";break; + } } putenv('LANGUAGE=');//sert à quoi? @@ -66,14 +66,12 @@ $lang = ($_SESSION['langue']!='') ? strtolower($_SESSION['langue']) : 'fr'; /* Date Format */ -$date_format['txt_full'] = _("%A, den %e. %B %Y"); //summary in choix_date.php and removal date in choix_(date|autre).php -$date_format['txt_short'] = "%A %e %B %Y"; // radio title -$date_format['txt_day'] = "%a %e"; -$date_format['txt_date'] = _("%Y-%m-%d"); +$date_format['txt_full'] = _('%A, den %e. %B %Y'); //summary in choix_date.php and removal date in choix_(date|autre).php +$date_format['txt_short'] = _('%A %e %B %Y'); // radio title +$date_format['txt_day'] = _('%a %e'); +$date_format['txt_date'] = _('%Y-%m-%d'); if (strtoupper(substr(PHP_OS,0,3))=='WIN'){ //%e can't be used on Windows platform, use %#d instead foreach($date_format as $k => $v) { $date_format[$k] = preg_replace('#(?template_dir = 'tpl/'; -$smarty->compile_dir = 'tpl_c/'; -$smarty->cache_dir = 'cache/'; +$smarty->setTemplateDir('tpl/'); +$smarty->setCompileDir('tpl_c/'); +$smarty->setCacheDir('cache/'); $smarty->caching = false; $smarty->assign('APPLICATION_NAME', NOMAPPLICATION); @@ -48,9 +53,5 @@ function smarty_modifier_poll_url($poll_id, $admin=false){return Utils::getUrlSo function smarty_modifier_markdown($md) {return Utils::markdown($md);} // End- Smarty -if (session_id() == '') { - session_start(); -} - $connect = new FramaDB(DB_CONNECTION_STRING, DB_USER, DB_PASSWORD); $err = 0; diff --git a/bandeaux.php b/bandeaux.php index 534bd43..1befbbb 100644 --- a/bandeaux.php +++ b/bandeaux.php @@ -28,7 +28,7 @@ function bandeau_titre($titre) echo '
'; if(count($ALLOWED_LANGUAGES)>1){ - echo '
+ echo '
diff --git a/tpl/header.tpl b/tpl/header.tpl index 58195c5..a0ca4de 100644 --- a/tpl/header.tpl +++ b/tpl/header.tpl @@ -1,10 +1,10 @@
{if count($langs)>1} - +