]> BookStack Code Mirror - bookstack/commitdiff
Merge branch 'unicode' of git://github.com/kostasdizas/BookStack into kostasdizas...
authorDan Brown <redacted>
Sun, 18 Aug 2019 17:51:20 +0000 (18:51 +0100)
committerDan Brown <redacted>
Sun, 18 Aug 2019 17:51:20 +0000 (18:51 +0100)
app/Http/Middleware/Localization.php
resources/views/base.blade.php
resources/views/books/export.blade.php
resources/views/chapters/export.blade.php
resources/views/pages/export.blade.php
resources/views/vendor/notifications/email.blade.php

index 07852bb00f735a8f265a80c8ac0c7a204a193ba6..29a4369548b4af622c9b60ee3f8b376c162b7e49 100644 (file)
@@ -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');
index da0e6eb44601fb2104a0410a36b2149a4d87c6be..456923c4ed5e221420d22c64e6be99bb0b630f71 100644 (file)
@@ -1,5 +1,5 @@
 <!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>
 
index 61c16c72dc586282f298cb0c2f98421dd0c3f688..fd1ba3fd1b0aff3b7d005f794f9dde6c0ad4382e 100644 (file)
@@ -1,5 +1,5 @@
 <!doctype html>
-<html lang="en">
+<html lang="{{ config('app.lang') }}" dir="{{ config('app.rtl') ? 'rtl' : 'ltr' }}">
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <title>{{ $book->name }}</title>
index 2830855b4f8a0fc53a132ebda8cc9c19b5e818e9..5fae78269215a3cf719a4820f31f51fad5d6bbb1 100644 (file)
@@ -1,5 +1,5 @@
 <!doctype html>
-<html lang="en">
+<html lang="{{ config('app.lang') }}" dir="{{ config('app.rtl') ? 'rtl' : 'ltr' }}">
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <title>{{ $chapter->name }}</title>
index e40643c256ff5346124a36dc717c5dada02fadde..970db3c2f2b820c0534876261847bd7a0abd0935 100644 (file)
@@ -1,5 +1,5 @@
 <!doctype html>
-<html lang="en">
+<html lang="{{ config('app.lang') }}" dir="{{ config('app.rtl') ? 'rtl' : 'ltr' }}">
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <title>{{ $page->name }}</title>
index b8a93643ae0424538c88a60b4b27326c345631e5..1b14adb28780a66a51be82f1ac76f2c97181ed10 100644 (file)
@@ -1,5 +1,5 @@
 <!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" />