diff --git a/app/Http/Middleware/Localization.php b/app/Http/Middleware/Localization.php index 07852bb00..b5e702781 100644 --- a/app/Http/Middleware/Localization.php +++ b/app/Http/Middleware/Localization.php @@ -57,6 +57,8 @@ class Localization $locale = setting()->getUser(user(), 'language', $defaultLang); } + config()->set('app.lang', str_replace('_', '-', $this->getLocaleIso($locale))); + // Set text direction if (in_array($locale, $this->rtlLocales)) { config()->set('app.rtl', true); @@ -86,6 +88,16 @@ class Localization return $default; } + /** + * Get the ISO version of a BookStack language name + * @param string $locale + * @return string + */ + public function getLocaleIso(string $locale) + { + return $this->localeMap[$locale] ?? $locale; + } + /** * Set the system date locale for localized date formatting. * Will try both the standard locale name and the UTF8 variant. @@ -93,7 +105,7 @@ class Localization */ protected function setSystemDateLocale(string $locale) { - $systemLocale = $this->localeMap[$locale] ?? $locale; + $systemLocale = $this->getLocaleIso($locale); $set = setlocale(LC_TIME, $systemLocale); if ($set === false) { setlocale(LC_TIME, $systemLocale . '.utf8'); diff --git a/resources/views/base.blade.php b/resources/views/base.blade.php index da0e6eb44..bb0a8cdda 100644 --- a/resources/views/base.blade.php +++ b/resources/views/base.blade.php @@ -1,5 +1,5 @@ - + {{ isset($pageTitle) ? $pageTitle . ' | ' : '' }}{{ setting('app-name') }} diff --git a/resources/views/books/export.blade.php b/resources/views/books/export.blade.php index 61c16c72d..4a7c45e0b 100644 --- a/resources/views/books/export.blade.php +++ b/resources/views/books/export.blade.php @@ -1,5 +1,5 @@ - + {{ $book->name }} diff --git a/resources/views/chapters/export.blade.php b/resources/views/chapters/export.blade.php index 2830855b4..580c123cc 100644 --- a/resources/views/chapters/export.blade.php +++ b/resources/views/chapters/export.blade.php @@ -1,5 +1,5 @@ - + {{ $chapter->name }} diff --git a/resources/views/pages/export.blade.php b/resources/views/pages/export.blade.php index e40643c25..4746a56f3 100644 --- a/resources/views/pages/export.blade.php +++ b/resources/views/pages/export.blade.php @@ -1,5 +1,5 @@ - + {{ $page->name }} diff --git a/resources/views/vendor/notifications/email.blade.php b/resources/views/vendor/notifications/email.blade.php index b8a93643a..f73b87b59 100644 --- a/resources/views/vendor/notifications/email.blade.php +++ b/resources/views/vendor/notifications/email.blade.php @@ -1,5 +1,5 @@ - +