Install: Fix change installation language

pull/5642/head
Angel Fernando Quiroz Campos 1 year ago
parent 4bf62d1bdc
commit 8ba6440168
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 3
      assets/vue/components/installer/Step1.vue
  2. 17
      public/main/install/index.php

@ -15,7 +15,7 @@
<Dropdown <Dropdown
v-model="installerData.langIso" v-model="installerData.langIso"
:filter="true" :filter="true"
:options="languages" :options="availableLanguages"
input-id="language_list" input-id="language_list"
option-label="english_name" option-label="english_name"
option-value="isocode" option-value="isocode"
@ -87,6 +87,7 @@ import Dropdown from 'primevue/dropdown';
import Button from 'primevue/button'; import Button from 'primevue/button';
import languages from '../../utils/languages'; import languages from '../../utils/languages';
const availableLanguages = languages.filter((language) => ["en_US", "fr_FR"].includes(language.isocode))
const { t } = useI18n(); const { t } = useI18n();

@ -66,9 +66,19 @@ putenv('APP_DEBUG=1');
session_start(); session_start();
Container::$session = new HttpSession();
require_once 'install.lib.php'; require_once 'install.lib.php';
$installationLanguage = 'en_US'; $installationLanguage = 'en_US';
if (!empty($_POST['language_list']) && !ChamiloSession::has('install_language')) {
$search = ['../', '\\0'];
$installationLanguage = str_replace($search, '', urldecode($_POST['language_list']));
ChamiloSession::write('install_language', $installationLanguage);
} elseif (ChamiloSession::has('install_language')) {
$installationLanguage = ChamiloSession::read('install_language');
}
// Set translation // Set translation
$translator = new Translator($installationLanguage); $translator = new Translator($installationLanguage);
$translator->addLoader('po', new PoFileLoader()); $translator->addLoader('po', new PoFileLoader());
@ -79,8 +89,6 @@ $translator->addResource(
); );
Container::$translator = $translator; Container::$translator = $translator;
Container::$session = new HttpSession();
// The function api_get_setting() might be called within the installation scripts. // The function api_get_setting() might be called within the installation scripts.
// We need to provide some limited support for it through initialization of the // We need to provide some limited support for it through initialization of the
// global array-type variable $_setting. // global array-type variable $_setting.
@ -109,14 +117,12 @@ $adminFirstName = get_lang('John');
$loginForm = 'admin'; $loginForm = 'admin';
$passForm = ''; $passForm = '';
$institutionUrlForm = 'https://chamilo.org'; $institutionUrlForm = 'https://chamilo.org';
$languageForm = ''; $languageForm = $installationLanguage;
$campusForm = 'My campus'; $campusForm = 'My campus';
$educationForm = 'Albert Einstein'; $educationForm = 'Albert Einstein';
$adminPhoneForm = '(000) 001 02 03'; $adminPhoneForm = '(000) 001 02 03';
$institutionForm = 'My Organisation'; $institutionForm = 'My Organisation';
$session_lifetime = 360000; $session_lifetime = 360000;
//$installLanguage = isset($_SESSION['install_language']) ? $_SESSION['install_language'] : 'english';
$installLanguage = '';
$installationGuideLink = '../../documentation/installation_guide.html'; $installationGuideLink = '../../documentation/installation_guide.html';
// Setting the error reporting levels. // Setting the error reporting levels.
@ -225,7 +231,6 @@ if (!isset($_GET['running'])) {
$loginForm = 'admin'; $loginForm = 'admin';
$passForm = api_generate_password(12, false); $passForm = api_generate_password(12, false);
$institutionUrlForm = 'https://chamilo.org'; $institutionUrlForm = 'https://chamilo.org';
$languageForm = api_get_language_isocode();
$checkEmailByHashSent = 0; $checkEmailByHashSent = 0;
$userMailCanBeEmpty = 1; $userMailCanBeEmpty = 1;
$allowSelfReg = 'approval'; $allowSelfReg = 'approval';

Loading…
Cancel
Save