mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Merge branch 'unicode' of git://github.com/kostasdizas/BookStack into kostasdizas-unicode
This commit is contained in:
@ -57,6 +57,8 @@ class Localization
|
||||
$locale = setting()->getUser(user(), 'language', $defaultLang);
|
||||
}
|
||||
|
||||
config()->set('app.lang', $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');
|
||||
|
Reference in New Issue
Block a user