]> 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)
1  2 
app/Http/Middleware/Localization.php
resources/views/base.blade.php
resources/views/vendor/notifications/email.blade.php

index 07852bb00f735a8f265a80c8ac0c7a204a193ba6,753fe438e0dbf8422ed3c647fa97cb63f1eae988..29a4369548b4af622c9b60ee3f8b376c162b7e49
@@@ -31,10 -31,12 +31,10 @@@ class Localizatio
          'nl' => 'nl_NL',
          'pl' => 'pl_PL',
          'pt_BR' => 'pt_BR',
 -        'pt_BR' => 'pt_BR',
          'ru' => 'ru',
          'sk' => 'sk_SK',
          'sv' => 'sv_SE',
          'uk' => 'uk_UA',
 -        'uk' => 'uk_UA',
          'zh_CN' => 'zh_CN',
          'zh_TW' => 'zh_TW',
      ];
@@@ -57,6 -59,8 +57,8 @@@
              $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');
index da0e6eb44601fb2104a0410a36b2149a4d87c6be,971a903401b5a8e2cfbdb38e5d2a8cd39a907a1e..456923c4ed5e221420d22c64e6be99bb0b630f71
@@@ -1,29 -1,26 +1,29 @@@
  <!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>
  
      <!-- Meta -->
      <meta name="viewport" content="width=device-width">
      <meta name="token" content="{{ csrf_token() }}">
 -    <meta name="base-url" content="{{ baseUrl('/') }}">
 +    <meta name="base-url" content="{{ url('/') }}">
      <meta charset="utf-8">
  
      <!-- Styles and Fonts -->
      <link rel="stylesheet" href="{{ versioned_asset('dist/styles.css') }}">
      <link rel="stylesheet" media="print" href="{{ versioned_asset('dist/print-styles.css') }}">
  
 -    <!-- Scripts -->
 -    <script src="{{ baseUrl('/translations') }}"></script>
 -
      @yield('head')
 +
 +    <!-- Custom Styles & Head Content -->
      @include('partials.custom-styles')
      @include('partials.custom-head')
  
      @stack('head')
 +
 +    <!-- Translations for JS -->
 +    @stack('translations')
 +
  </head>
  <body class="@yield('body-class')">
  
index b8a93643ae0424538c88a60b4b27326c345631e5,8d63fedfdec4afecd40581e7c6462fc3a8a9babc..1b14adb28780a66a51be82f1ac76f2c97181ed10
@@@ -1,5 -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" />
@@@ -83,7 -83,7 +83,7 @@@ $style = 
                                  <!-- Logo -->
                                  <tr>
                                      <td style="{{ $style['email-masthead'] }}">
 -                                        <a style="{{ $fontFamily }} {{ $style['email-masthead_name'] }}" href="{{ baseUrl('/') }}" target="_blank">
 +                                        <a style="{{ $fontFamily }} {{ $style['email-masthead_name'] }}" href="{{ url('/') }}" target="_blank">
                                              {{ setting('app-name') }}
                                          </a>
                                      </td>
                                                  <td style="{{ $fontFamily }} {{ $style['email-footer_cell'] }}">
                                                      <p style="{{ $style['paragraph-sub'] }}">
                                                          &copy; {{ date('Y') }}
 -                                                        <a style="{{ $style['anchor'] }}" href="{{ baseUrl('/') }}" target="_blank">{{ setting('app-name') }}</a>.
 +                                                        <a style="{{ $style['anchor'] }}" href="{{ url('/') }}" target="_blank">{{ setting('app-name') }}</a>.
                                                          {{ trans('common.email_rights') }}
                                                      </p>
                                                  </td>