Allow the user to select their own preferred language (#1263)
This commit is contained in:
parent
ffb19f113a
commit
905dd59425
9 changed files with 75 additions and 3 deletions
|
@ -73,6 +73,7 @@ class Accounts {
|
||||||
'user_email' => $user['email'],
|
'user_email' => $user['email'],
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'timezone' => ! empty($user['timezone']) ? $user['timezone'] : $default_timezone,
|
'timezone' => ! empty($user['timezone']) ? $user['timezone'] : $default_timezone,
|
||||||
|
'language' => ! empty($user['language']) ? $user['language'] : Config::LANGUAGE,
|
||||||
'role_slug' => $role['slug'],
|
'role_slug' => $role['slug'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,20 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="language">
|
||||||
|
<?= lang('language') ?>
|
||||||
|
<span class="text-danger" hidden>*</span>
|
||||||
|
</label>
|
||||||
|
<select id="language" class="form-control required">
|
||||||
|
<?php foreach (vars('available_languages') as $available_language): ?>
|
||||||
|
<option value="<?= $available_language ?>">
|
||||||
|
<?= ucfirst($available_language) ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="timezone">
|
<label class="form-label" for="timezone">
|
||||||
<?= lang('timezone') ?>
|
<?= lang('timezone') ?>
|
||||||
|
|
|
@ -171,6 +171,20 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="language">
|
||||||
|
<?= lang('language') ?>
|
||||||
|
<span class="text-danger" hidden>*</span>
|
||||||
|
</label>
|
||||||
|
<select id="language" class="form-control required" disabled>
|
||||||
|
<?php foreach (vars('available_languages') as $available_language): ?>
|
||||||
|
<option value="<?= $available_language ?>">
|
||||||
|
<?= ucfirst($available_language) ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="timezone">
|
<label class="form-label" for="timezone">
|
||||||
<?= lang('timezone') ?>
|
<?= lang('timezone') ?>
|
||||||
|
|
|
@ -207,6 +207,21 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="language">
|
||||||
|
<?= lang('language') ?>
|
||||||
|
<span class="text-danger" hidden>*</span>
|
||||||
|
</label>
|
||||||
|
<select id="language" class="form-control required" disabled>
|
||||||
|
<?php foreach (vars('available_languages') as $available_language): ?>
|
||||||
|
<option value="<?= $available_language ?>">
|
||||||
|
<?= ucfirst($available_language) ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="timezone">
|
<label class="form-label" for="timezone">
|
||||||
<?= lang('timezone') ?>
|
<?= lang('timezone') ?>
|
||||||
|
|
|
@ -170,6 +170,20 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="language">
|
||||||
|
<?= lang('language') ?>
|
||||||
|
<span class="text-danger" hidden>*</span>
|
||||||
|
</label>
|
||||||
|
<select id="language" class="form-control required" disabled>
|
||||||
|
<?php foreach (vars('available_languages') as $available_language): ?>
|
||||||
|
<option value="<?= $available_language ?>">
|
||||||
|
<?= ucfirst($available_language) ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="timezone">
|
<label class="form-label" for="timezone">
|
||||||
<?= lang('timezone') ?>
|
<?= lang('timezone') ?>
|
||||||
|
|
|
@ -26,7 +26,8 @@ App.Pages.Account = (function () {
|
||||||
const $state = $('#state');
|
const $state = $('#state');
|
||||||
const $zipCode = $('#zip-code');
|
const $zipCode = $('#zip-code');
|
||||||
const $notes = $('#notes');
|
const $notes = $('#notes');
|
||||||
const $timezones = $('#timezone');
|
const $language = $('#language');
|
||||||
|
const $timezone = $('#timezone');
|
||||||
const $username = $('#username');
|
const $username = $('#username');
|
||||||
const $password = $('#password');
|
const $password = $('#password');
|
||||||
const $retypePassword = $('#retype-password');
|
const $retypePassword = $('#retype-password');
|
||||||
|
@ -106,7 +107,8 @@ App.Pages.Account = (function () {
|
||||||
$state.val(account.state);
|
$state.val(account.state);
|
||||||
$zipCode.val(account.zip_code);
|
$zipCode.val(account.zip_code);
|
||||||
$notes.val(account.notes);
|
$notes.val(account.notes);
|
||||||
$timezones.val(account.timezone);
|
$language.val(account.language);
|
||||||
|
$timezone.val(account.timezone);
|
||||||
$username.val(account.settings.username);
|
$username.val(account.settings.username);
|
||||||
$password.val('');
|
$password.val('');
|
||||||
$retypePassword.val('');
|
$retypePassword.val('');
|
||||||
|
@ -132,7 +134,8 @@ App.Pages.Account = (function () {
|
||||||
state: $state.val(),
|
state: $state.val(),
|
||||||
zip_code: $zipCode.val(),
|
zip_code: $zipCode.val(),
|
||||||
notes: $notes.val(),
|
notes: $notes.val(),
|
||||||
timezone: $timezones.val(),
|
language: $language.val(),
|
||||||
|
timezone: $timezone.val(),
|
||||||
settings: {
|
settings: {
|
||||||
username: $username.val(),
|
username: $username.val(),
|
||||||
password: $password.val() || null,
|
password: $password.val() || null,
|
||||||
|
|
|
@ -27,6 +27,7 @@ App.Pages.Admins = (function () {
|
||||||
const $state = $('#state');
|
const $state = $('#state');
|
||||||
const $zipCode = $('#zip-code');
|
const $zipCode = $('#zip-code');
|
||||||
const $notes = $('#notes');
|
const $notes = $('#notes');
|
||||||
|
const $language = $('#language');
|
||||||
const $timezone = $('#timezone');
|
const $timezone = $('#timezone');
|
||||||
const $username = $('#username');
|
const $username = $('#username');
|
||||||
const $password = $('#password');
|
const $password = $('#password');
|
||||||
|
@ -183,6 +184,7 @@ App.Pages.Admins = (function () {
|
||||||
state: $state.val(),
|
state: $state.val(),
|
||||||
zip_code: $zipCode.val(),
|
zip_code: $zipCode.val(),
|
||||||
notes: $notes.val(),
|
notes: $notes.val(),
|
||||||
|
language: $language.val(),
|
||||||
timezone: $timezone.val(),
|
timezone: $timezone.val(),
|
||||||
settings: {
|
settings: {
|
||||||
username: $username.val(),
|
username: $username.val(),
|
||||||
|
@ -334,6 +336,7 @@ App.Pages.Admins = (function () {
|
||||||
$admins.find('.record-details').find('input, select, textarea').val('').prop('disabled', true);
|
$admins.find('.record-details').find('input, select, textarea').val('').prop('disabled', true);
|
||||||
$admins.find('.record-details .form-label span').prop('hidden', true);
|
$admins.find('.record-details .form-label span').prop('hidden', true);
|
||||||
$admins.find('.record-details #calendar-view').val('default');
|
$admins.find('.record-details #calendar-view').val('default');
|
||||||
|
$admins.find('.record-details #language').val('english');
|
||||||
$admins.find('.record-details #timezone').val('UTC');
|
$admins.find('.record-details #timezone').val('UTC');
|
||||||
$('#edit-admin, #delete-admin').prop('disabled', true);
|
$('#edit-admin, #delete-admin').prop('disabled', true);
|
||||||
|
|
||||||
|
@ -358,6 +361,7 @@ App.Pages.Admins = (function () {
|
||||||
$state.val(admin.state);
|
$state.val(admin.state);
|
||||||
$zipCode.val(admin.zip_code);
|
$zipCode.val(admin.zip_code);
|
||||||
$notes.val(admin.notes);
|
$notes.val(admin.notes);
|
||||||
|
$language.val(admin.language);
|
||||||
$timezone.val(admin.timezone);
|
$timezone.val(admin.timezone);
|
||||||
|
|
||||||
$username.val(admin.settings.username);
|
$username.val(admin.settings.username);
|
||||||
|
|
|
@ -28,6 +28,7 @@ App.Pages.Providers = (function () {
|
||||||
const $zipCode = $('#zip-code');
|
const $zipCode = $('#zip-code');
|
||||||
const $private = $('#private');
|
const $private = $('#private');
|
||||||
const $notes = $('#notes');
|
const $notes = $('#notes');
|
||||||
|
const $language = $('#language');
|
||||||
const $timezone = $('#timezone');
|
const $timezone = $('#timezone');
|
||||||
const $username = $('#username');
|
const $username = $('#username');
|
||||||
const $password = $('#password');
|
const $password = $('#password');
|
||||||
|
@ -165,6 +166,7 @@ App.Pages.Providers = (function () {
|
||||||
zip_code: $zipCode.val(),
|
zip_code: $zipCode.val(),
|
||||||
is_private: Number($private.prop('checked')),
|
is_private: Number($private.prop('checked')),
|
||||||
notes: $notes.val(),
|
notes: $notes.val(),
|
||||||
|
language: $language.val(),
|
||||||
timezone: $timezone.val(),
|
timezone: $timezone.val(),
|
||||||
settings: {
|
settings: {
|
||||||
username: $username.val(),
|
username: $username.val(),
|
||||||
|
@ -345,6 +347,7 @@ App.Pages.Providers = (function () {
|
||||||
$providers.find('.record-details').find('input, select, textarea').val('').prop('disabled', true);
|
$providers.find('.record-details').find('input, select, textarea').val('').prop('disabled', true);
|
||||||
$providers.find('.record-details .form-label span').prop('hidden', true);
|
$providers.find('.record-details .form-label span').prop('hidden', true);
|
||||||
$providers.find('.record-details #calendar-view').val('default');
|
$providers.find('.record-details #calendar-view').val('default');
|
||||||
|
$providers.find('.record-details #language').val('english');
|
||||||
$providers.find('.record-details #timezone').val('UTC');
|
$providers.find('.record-details #timezone').val('UTC');
|
||||||
$providers.find('.add-break, .add-working-plan-exception, #reset-working-plan').prop('disabled', true);
|
$providers.find('.add-break, .add-working-plan-exception, #reset-working-plan').prop('disabled', true);
|
||||||
|
|
||||||
|
@ -385,6 +388,7 @@ App.Pages.Providers = (function () {
|
||||||
$zipCode.val(provider.zip_code);
|
$zipCode.val(provider.zip_code);
|
||||||
$private.prop('checked', provider.is_private);
|
$private.prop('checked', provider.is_private);
|
||||||
$notes.val(provider.notes);
|
$notes.val(provider.notes);
|
||||||
|
$language.val(provider.language);
|
||||||
$timezone.val(provider.timezone);
|
$timezone.val(provider.timezone);
|
||||||
|
|
||||||
$username.val(provider.settings.username);
|
$username.val(provider.settings.username);
|
||||||
|
|
|
@ -27,6 +27,7 @@ App.Pages.Secretaries = (function () {
|
||||||
const $state = $('#state');
|
const $state = $('#state');
|
||||||
const $zipCode = $('#zip-code');
|
const $zipCode = $('#zip-code');
|
||||||
const $notes = $('#notes');
|
const $notes = $('#notes');
|
||||||
|
const $language = $('#language');
|
||||||
const $timezone = $('#timezone');
|
const $timezone = $('#timezone');
|
||||||
const $username = $('#username');
|
const $username = $('#username');
|
||||||
const $password = $('#password');
|
const $password = $('#password');
|
||||||
|
@ -187,6 +188,7 @@ App.Pages.Secretaries = (function () {
|
||||||
state: $state.val(),
|
state: $state.val(),
|
||||||
zip_code: $zipCode.val(),
|
zip_code: $zipCode.val(),
|
||||||
notes: $notes.val(),
|
notes: $notes.val(),
|
||||||
|
language: $language.val(),
|
||||||
timezone: $timezone.val(),
|
timezone: $timezone.val(),
|
||||||
settings: {
|
settings: {
|
||||||
username: $username.val(),
|
username: $username.val(),
|
||||||
|
@ -370,6 +372,7 @@ App.Pages.Secretaries = (function () {
|
||||||
$state.val(secretary.state);
|
$state.val(secretary.state);
|
||||||
$zipCode.val(secretary.zip_code);
|
$zipCode.val(secretary.zip_code);
|
||||||
$notes.val(secretary.notes);
|
$notes.val(secretary.notes);
|
||||||
|
$language.val(secretary.language);
|
||||||
$timezone.val(secretary.timezone);
|
$timezone.val(secretary.timezone);
|
||||||
|
|
||||||
$username.val(secretary.settings.username);
|
$username.val(secretary.settings.username);
|
||||||
|
|
Loading…
Reference in a new issue