diff --git a/app/inc/i18n.php b/app/inc/i18n.php
index bd4a332104b4fb776f5b6220f7038bd0129712dc..c3e7c1ddf17d2ad12b6f91ed703ec2e085061318 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="$html_lang"> */
-$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 63cea1d111689694a1294a2fd1841232b25784c6..1e9436b2909274e0a47507bcd722fcfadb4b8901 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 84d8852f3519c816eaad47912d5a22e2f31c504a..a4eb83c36859cad1a14b94544bf9c79d3f9b9931 100644
--- a/tpl/header.tpl
+++ b/tpl/header.tpl
@@ -4,7 +4,7 @@
             <div class="input-group input-group-sm pull-right col-md-2 col-xs-4">
                 <select name="lang" class="form-control" title="{__('Language selector', 'Select the language')}" >
                 {foreach $langs as $lang_key=>$lang_value}
-                    <option lang="{substr($lang_key, 0, 2)}" {if substr($lang_key, 0, 2)==$html_lang}selected{/if} value="{$lang_key|html}">{$lang_value|html}</option>
+                    <option lang="{substr($lang_key, 0, 2)}" {if substr($lang_key, 0, 2)==$locale}selected{/if} value="{$lang_key|html}">{$lang_value|html}</option>
                 {/foreach}
                 </select>
                 <span class="input-group-btn">
diff --git a/tpl/page.tpl b/tpl/page.tpl
index 1d94cf703ce43ae8e5cd804ccc949a0ce24c1719..8312531810946e0e7259a0da1ad5e1b7b42e9ca7 100644
--- a/tpl/page.tpl
+++ b/tpl/page.tpl
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="{$html_lang}">
+<html lang="{$locale}">
 <head>
     <meta charset="utf-8">