]> git.agnieray.net Git - galette.git/commitdiff
Fix lang selector at install; closes #1366
authorJohan Cwiklinski <jcwiklinski@teclib.com>
Fri, 29 Nov 2019 07:30:14 +0000 (08:30 +0100)
committerJohan Cwiklinski <jcwiklinski@teclib.com>
Fri, 29 Nov 2019 07:30:14 +0000 (08:30 +0100)
galette/includes/dependencies.php
galette/webroot/installer.php

index 89045a7851d32465fd00772380343bba3cbd85f1..8e587d151a8770de4676bfb903d2600c55dcad07 100644 (file)
@@ -180,8 +180,8 @@ $container['plugins'] = function ($c) use ($app) {
 
 $container['i18n'] = function ($c) {
     $i18n = $c->get('session')->i18n;
-    if (!$i18n || !$i18n->getId()) {
-        $i18n = new Galette\Core\I18n();
+    if (!$i18n || !$i18n->getId() || $_GET['ui_pref_lang']) {
+        $i18n = new Galette\Core\I18n($_GET['ui_pref_lang'] ?? false);
         $c->get('session')->i18n = $i18n;
     }
     return $i18n;
index d7be0e800ab74a34ac49cb9da23857f8fa5522ba..aac248892aae536126d96645a7665339ebbed19c 100644 (file)
@@ -72,10 +72,6 @@ $app = new \Slim\App(
 );
 require_once '../includes/dependencies.php';
 
-if (isset($_GET['pref_lang'])) {
-    $i18n->changeLanguage($_GET['pref_lang']);
-}
-
 if (isset($_POST['abort_btn'])) {
     if (isset($session[md5(GALETTE_ROOT)])) {
         unset($session[md5(GALETTE_ROOT)]);
@@ -246,11 +242,14 @@ header('Content-Type: text/html; charset=UTF-8');
         <link rel="stylesheet" type="text/css" href="./themes/default/galette.css"/>
         <link rel="stylesheet" type="text/css" href="./themes/default/install.css"/>
         <link rel="stylesheet" type="text/css" href="./themes/default/jquery-ui/jquery-ui-<?php echo JQUERY_UI_VERSION; ?>.custom.css"/>
+        <link rel="stylesheet" type="text/css" href="./js/selectize-0.12.6/css/selectize.css" />
+        <link rel="stylesheet" type="text/css" href="./js/selectize-0.12.6/css/selectize.default.css" />
         <script type="text/javascript" src="./js/jquery/jquery-<?php echo JQUERY_VERSION; ?>.min.js"></script>
         <script type="text/javascript" src="./js/jquery/jquery-migrate-<?php echo JQUERY_MIGRATE_VERSION; ?>.min.js"></script>
         <script type="text/javascript" src="./js/jquery/jquery-ui-<?php echo JQUERY_UI_VERSION; ?>/jquery.ui.widget.min.js"></script>
         <script type="text/javascript" src="./js//jquery/jquery-ui-<?php echo JQUERY_UI_VERSION; ?>/jquery.ui.button.min.js"></script>
         <script type="text/javascript" src="./js/jquery/jquery-ui-<?php echo JQUERY_UI_VERSION; ?>/jquery.ui.tooltip.min.js"></script>
+        <script type="text/javascript" src="./js/selectize-0.12.6/js/standalone/selectize.min.js"></script>
         <script type="text/javascript" src="./js/jquery/jquery.bgFade.js"></script>
         <script type="text/javascript" src="./js/common.js"></script>
         <link rel="shortcut icon" href="./themes/default/images/favicon.png" />
@@ -267,7 +266,7 @@ header('Content-Type: text/html; charset=UTF-8');
 <?php
 foreach ($i18n->getList() as $langue) {
     ?>
-                        <option value="<?php echo $langue->getID(); ?>" lang="<?php echo $langue->getAbbrev(); ?>"<?php if ($galette_lang == $langue->getAbbrev()) { echo ' selected="selected"'; } ?>><?php echo $langue->getName(); ?></option>
+                        <option value="<?php echo $langue->getID(); ?>" lang="<?php echo $langue->getAbbrev(); ?>"<?php if ($i18n->getAbbrev() == $langue->getAbbrev()) { echo ' selected="selected"'; } ?>><?php echo $langue->getName(); ?></option>
     <?php
 }
 ?>