mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 20:22:18 +00:00
Updated user language select to use correct default
- Updated localisation system to take note of system defaul locale before replacing the current locale Fixes #1316
This commit is contained in:
parent
b273b9d6d0
commit
98a4359198
@ -51,6 +51,7 @@ class Localization
|
|||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
$defaultLang = config('app.locale');
|
$defaultLang = config('app.locale');
|
||||||
|
config()->set('app.default_locale', $defaultLang);
|
||||||
|
|
||||||
if (user()->isDefault() && config('app.auto_detect_locale')) {
|
if (user()->isDefault() && config('app.auto_detect_locale')) {
|
||||||
$locale = $this->autoDetectLocale($request, $defaultLang);
|
$locale = $this->autoDetectLocale($request, $defaultLang);
|
||||||
@ -63,8 +64,6 @@ class Localization
|
|||||||
config()->set('app.rtl', true);
|
config()->set('app.rtl', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app()->setLocale($locale);
|
app()->setLocale($locale);
|
||||||
Carbon::setLocale($locale);
|
Carbon::setLocale($locale);
|
||||||
$this->setSystemDateLocale($locale);
|
$this->setSystemDateLocale($locale);
|
||||||
|
@ -41,6 +41,7 @@ class SettingService
|
|||||||
if ($default === false) {
|
if ($default === false) {
|
||||||
$default = config('setting-defaults.' . $key, false);
|
$default = config('setting-defaults.' . $key, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->localCache[$key])) {
|
if (isset($this->localCache[$key])) {
|
||||||
return $this->localCache[$key];
|
return $this->localCache[$key];
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,9 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="user-language">{{ trans('settings.users_preferred_language') }}</label>
|
<label for="user-language">{{ trans('settings.users_preferred_language') }}</label>
|
||||||
<select name="setting[language]" id="user-language">
|
<select name="setting[language]" id="user-language">
|
||||||
|
|
||||||
@foreach(trans('settings.language_select') as $lang => $label)
|
@foreach(trans('settings.language_select') as $lang => $label)
|
||||||
<option @if(setting()->getUser($user, 'language') === $lang) selected @endif value="{{ $lang }}">{{ $label }}</option>
|
<option @if(setting()->getUser($user, 'language', config('app.default_locale')) === $lang) selected @endif value="{{ $lang }}">{{ $label }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user