diff --git a/app/inc/i18n.php b/app/inc/i18n.php index bd4a332..c3e7c1d 100644 --- a/app/inc/i18n.php +++ b/app/inc/i18n.php @@ -17,9 +17,6 @@ * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft) */ -// Sort languages -asort($ALLOWED_LANGUAGES); - // Prepare I18N instance $i18n = \o80\i18n\I18N::instance(); $i18n->setDefaultLang(DEFAULT_LANGUAGE); @@ -27,16 +24,12 @@ $i18n->setPath(__DIR__ . '/../../locale'); // Change langauge when user asked for it if (isset($_POST['lang']) && is_string($_POST['lang']) && in_array($_POST['lang'], array_keys($ALLOWED_LANGUAGES))) { - $locale = $_POST['lang']; $_SESSION['lang'] = $_POST['lang']; -} elseif (!empty($_SESSION['lang'])) { - $locale = $_SESSION['lang']; -} else { - $locale = DEFAULT_LANGUAGE; } /* */ -$html_lang = substr($locale, 0, 2); +$i18n->get('Something, just to load the dictionary'); +$locale = $i18n->getLoadedLang(); /* Date Format */ $date_format['txt_full'] = __('Date', 'FULL'); //summary in create_date_poll.php and removal date in choix_(date|autre).php diff --git a/app/inc/smarty.php b/app/inc/smarty.php index 63cea1d..1e9436b 100644 --- a/app/inc/smarty.php +++ b/app/inc/smarty.php @@ -30,7 +30,7 @@ $smarty->assign('SERVER_URL', Utils::get_server_name()); $smarty->assign('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']); $smarty->assign('TITLE_IMAGE', IMAGE_TITRE); $smarty->assign('use_nav_js', file_exists($_SERVER['DOCUMENT_ROOT'] . '/nav/nav.js')); -$smarty->assign('html_lang', $html_lang); +$smarty->assign('locale', $locale); $smarty->assign('langs', $ALLOWED_LANGUAGES); $smarty->assign('date_format', $date_format); diff --git a/tpl/header.tpl b/tpl/header.tpl index 84d8852..a4eb83c 100644 --- a/tpl/header.tpl +++ b/tpl/header.tpl @@ -4,7 +4,7 @@