Install: Admin Add Language selector + set timezone by server

This commit is contained in:
Thomas Ingles 2024-04-30 17:21:20 +02:00
parent c81ba8da21
commit 556b77c08d
No known key found for this signature in database
GPG key ID: 02A5671B95EAD354
3 changed files with 19 additions and 1 deletions

View file

@ -67,7 +67,7 @@ class Installation extends EA_Controller
$this->instance->migrate();
// Insert admin
$admin['timezone'] = 'UTC';
$admin['timezone'] = date_default_timezone_get();
$admin['settings']['username'] = $admin['username'];
$admin['settings']['password'] = $admin['password'];
$admin['settings']['notifications'] = true;
@ -79,6 +79,7 @@ class Installation extends EA_Controller
'user_id' => $admin['id'],
'user_email' => $admin['email'],
'role_slug' => DB_SLUG_ADMIN,
'language' => $admin['language'],
'timezone' => $admin['timezone'],
'username' => $admin['settings']['username'],
]);

View file

@ -101,6 +101,21 @@
<input type="password" id="password-confirm" class="form-control required" maxlength="512">
</div>
<div class="mb-3">
<label class="form-label" for="language">
<?= lang('language') ?>
<span class="text-danger">*</span>
</label>
<select id="language" class="form-control required">
<?php $config_lang = config('language');
foreach (vars('available_languages') as $lang): ?>
<option value="<?= $lang ?>"<?= ($lang == $config_lang ?' selected':'') ?>>
<?= ucfirst($lang) ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="company-settings col-12 col-sm-5">

View file

@ -26,6 +26,7 @@ App.Pages.Installation = (function () {
const $username = $('#username');
const $password = $('#password');
const $passwordConfirm = $('#password-confirm');
const $language = $('#language');
const $companyName = $('#company-name');
const $companyEmail = $('#company-email');
const $companyLink = $('#company-link');
@ -145,6 +146,7 @@ App.Pages.Installation = (function () {
phone_number: $phoneNumber.val(),
username: $username.val(),
password: $password.val(),
language: $language.val(),
};
}