$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);
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.
*/
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');
<!DOCTYPE html>
-<html class="@yield('body-class')">
+<html lang="{{ config('app.lang') }}" dir="{{ config('app.rtl') ? 'rtl' : 'ltr' }}" class="@yield('body-class')">
<head>
<title>{{ isset($pageTitle) ? $pageTitle . ' | ' : '' }}{{ setting('app-name') }}</title>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
+<html lang="{{ config('app.lang') }}" dir="{{ config('app.rtl') ? 'rtl' : 'ltr' }}">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />