Enable language selector into admin bar

This commit is contained in:
Fred Tempez 2022-12-31 16:17:51 +01:00
parent b7266092fa
commit 2739909b6c
2 changed files with 13 additions and 8 deletions

View File

@ -253,14 +253,19 @@ core.start = function() {
/** /**
* Sélection d'une langue du site * Sélection d'une langue du site
*/
$("#barSelectLanguage").on("change", function() { $("select#barSelectLanguage").on("change", function() {
var langUrl = $(this).val(); var langUrl = $(this).val();
// Récupère la langue sélectionnée dans l'élément 6 d'un tableau
var lang = langUrl.split("/");
// Lit le cookie de langue
var langCookie = getCookie('ZWII_CONTENT'); var langCookie = getCookie('ZWII_CONTENT');
if (langUrl !== langCookie) { // Change si différent, corrige le problème avec le thème et le rechargement de la langue.
if (lang[6] !== langCookie) {
$(location).attr("href", langUrl); $(location).attr("href", langUrl);
} }
});*/ });
/** /**
* Choix de page dans la barre de membre * Choix de page dans la barre de membre
*/ */

View File

@ -2142,13 +2142,13 @@ class common
if (is_dir(self::DATA_DIR . $key)) { if (is_dir(self::DATA_DIR . $key)) {
$c++; $c++;
$location = helper::baseUrl() . 'translate/content/' . $key ; $location = helper::baseUrl() . 'translate/content/' . $key ;
$leftItem .= '<option value="' . $location . '" ' . ($key === self::$i18nContent ? 'selected' : '') . '>' . $value . '</option>'; $leftItem .= '<option name="' . $key . '" value="' . $location . '" ' . ($key === self::$i18nContent ? 'selected' : '') . '>' . $value . '</option>';
} }
} }
if ($c > 1 ) { if ($c > 1 ) {
//$leftItems .= '<li><select id="barSelectLanguage">'; $leftItems .= '<li><select id="barSelectLanguage">';
//$leftItems .= $leftItem; $leftItems .= $leftItem;
//$leftItems .= '</select></li>'; $leftItems .= '</select></li>';
} }
} }