mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 21:11:55 +08:00
Merge pull request #2243 from flarum/fl/2055-l6-translator
Upgrade to Laravel 6, finally!
This commit is contained in:
commit
352f537c9d
|
@ -41,21 +41,21 @@
|
|||
"dflydev/fig-cookies": "^2.0.1",
|
||||
"doctrine/dbal": "^2.7",
|
||||
"franzl/whoops-middleware": "^0.4.0",
|
||||
"illuminate/bus": "5.8.*",
|
||||
"illuminate/cache": "5.8.*",
|
||||
"illuminate/config": "5.8.*",
|
||||
"illuminate/container": "5.8.*",
|
||||
"illuminate/contracts": "5.8.*",
|
||||
"illuminate/database": "5.8.*",
|
||||
"illuminate/events": "5.8.*",
|
||||
"illuminate/filesystem": "5.8.*",
|
||||
"illuminate/hashing": "5.8.*",
|
||||
"illuminate/mail": "5.8.*",
|
||||
"illuminate/queue": "5.8.*",
|
||||
"illuminate/session": "5.8.*",
|
||||
"illuminate/support": "5.8.*",
|
||||
"illuminate/validation": "5.8.*",
|
||||
"illuminate/view": "5.8.*",
|
||||
"illuminate/bus": "^6.0",
|
||||
"illuminate/cache": "^6.0",
|
||||
"illuminate/config": "^6.0",
|
||||
"illuminate/container": "^6.0",
|
||||
"illuminate/contracts": "^6.0",
|
||||
"illuminate/database": "^6.0",
|
||||
"illuminate/events": "^6.0",
|
||||
"illuminate/filesystem": "^6.0",
|
||||
"illuminate/hashing": "^6.0",
|
||||
"illuminate/mail": "^6.0",
|
||||
"illuminate/queue": "^6.0",
|
||||
"illuminate/session": "^6.0",
|
||||
"illuminate/support": "^6.0",
|
||||
"illuminate/validation": "^6.0",
|
||||
"illuminate/view": "^6.0",
|
||||
"intervention/image": "^2.5.0",
|
||||
"laminas/laminas-diactoros": "^1.8.4",
|
||||
"laminas/laminas-httphandlerrunner": "^1.0",
|
||||
|
|
|
@ -267,7 +267,7 @@ class Extension implements Arrayable
|
|||
$extenders = [$extenders];
|
||||
}
|
||||
|
||||
return array_flatten($extenders);
|
||||
return Arr::flatten($extenders);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,10 +15,10 @@ use Flarum\Frontend\Document;
|
|||
use Flarum\Http\UrlGenerator;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Support\Arr;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class Index
|
||||
{
|
||||
|
@ -42,14 +42,19 @@ class Index
|
|||
*/
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
/**
|
||||
* @param Client $api
|
||||
* @param Factory $view
|
||||
* @param SettingsRepositoryInterface $settings
|
||||
* @param UrlGenerator $url
|
||||
* @param Translator $translator
|
||||
* @param TranslatorInterface $translator
|
||||
*/
|
||||
public function __construct(Client $api, Factory $view, SettingsRepositoryInterface $settings, UrlGenerator $url, Translator $translator)
|
||||
public function __construct(Client $api, Factory $view, SettingsRepositoryInterface $settings, UrlGenerator $url, TranslatorInterface $translator)
|
||||
{
|
||||
$this->api = $api;
|
||||
$this->view = $view;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
namespace Flarum\Foundation;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use RuntimeException;
|
||||
|
||||
class Site
|
||||
|
@ -62,6 +63,6 @@ class Site
|
|||
return [];
|
||||
}
|
||||
|
||||
return array_flatten($extenders);
|
||||
return Arr::flatten($extenders);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use Flarum\Foundation\Application;
|
|||
use Flarum\Frontend\Compiler\CompilerInterface;
|
||||
use Flarum\Frontend\Document;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Support\Arr;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
class Assets
|
||||
|
@ -48,7 +49,7 @@ class Assets
|
|||
];
|
||||
|
||||
if ($this->app->inDebugMode()) {
|
||||
$this->commit(array_flatten($compilers));
|
||||
$this->commit(Arr::flatten($compilers));
|
||||
}
|
||||
|
||||
$document->js = array_merge($document->js, $this->getUrls($compilers['js']));
|
||||
|
|
|
@ -17,6 +17,16 @@ class Translator extends BaseTranslator implements TranslatorContract
|
|||
{
|
||||
const REFERENCE_REGEX = '/^=>\s*([a-z0-9_\-\.]+)$/i';
|
||||
|
||||
public function get($key, array $replace = [], $locale = null)
|
||||
{
|
||||
return $this->trans($key, $replace, null, $locale);
|
||||
}
|
||||
|
||||
public function choice($key, $number, array $replace = [], $locale = null)
|
||||
{
|
||||
return $this->transChoice($key, $number, $replace, nil, $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@ use Flarum\Mail\Job\SendRawEmailJob;
|
|||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\User\Event\Registered;
|
||||
use Illuminate\Contracts\Queue\Queue;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class AccountActivationMailer
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ class AccountActivationMailer
|
|||
protected $url;
|
||||
|
||||
/**
|
||||
* @var Translator
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
|
@ -42,9 +42,9 @@ class AccountActivationMailer
|
|||
* @param \Flarum\Settings\SettingsRepositoryInterface $settings
|
||||
* @param Queue $queue
|
||||
* @param UrlGenerator $url
|
||||
* @param Translator $translator
|
||||
* @param TranslatorInterface $translator
|
||||
*/
|
||||
public function __construct(SettingsRepositoryInterface $settings, Queue $queue, UrlGenerator $url, Translator $translator)
|
||||
public function __construct(SettingsRepositoryInterface $settings, Queue $queue, UrlGenerator $url, TranslatorInterface $translator)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
$this->queue = $queue;
|
||||
|
|
|
@ -15,10 +15,10 @@ use Flarum\Settings\SettingsRepositoryInterface;
|
|||
use Flarum\User\PasswordToken;
|
||||
use Flarum\User\UserRepository;
|
||||
use Illuminate\Contracts\Queue\Queue;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Illuminate\Contracts\Validation\Factory;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class RequestPasswordResetHandler
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ class RequestPasswordResetHandler
|
|||
protected $url;
|
||||
|
||||
/**
|
||||
* @var Translator
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
|
@ -57,7 +57,7 @@ class RequestPasswordResetHandler
|
|||
* @param SettingsRepositoryInterface $settings
|
||||
* @param Queue $queue
|
||||
* @param UrlGenerator $url
|
||||
* @param Translator $translator
|
||||
* @param TranslatorInterface $translator
|
||||
* @param Factory $validatorFactory
|
||||
*/
|
||||
public function __construct(
|
||||
|
@ -65,7 +65,7 @@ class RequestPasswordResetHandler
|
|||
SettingsRepositoryInterface $settings,
|
||||
Queue $queue,
|
||||
UrlGenerator $url,
|
||||
Translator $translator,
|
||||
TranslatorInterface $translator,
|
||||
Factory $validatorFactory
|
||||
) {
|
||||
$this->users = $users;
|
||||
|
|
|
@ -14,7 +14,7 @@ use Flarum\Mail\Job\SendRawEmailJob;
|
|||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\User\Event\EmailChangeRequested;
|
||||
use Illuminate\Contracts\Queue\Queue;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
class EmailConfirmationMailer
|
||||
{
|
||||
|
@ -34,11 +34,11 @@ class EmailConfirmationMailer
|
|||
protected $url;
|
||||
|
||||
/**
|
||||
* @var Translator
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(SettingsRepositoryInterface $settings, Queue $queue, UrlGenerator $url, Translator $translator)
|
||||
public function __construct(SettingsRepositoryInterface $settings, Queue $queue, UrlGenerator $url, TranslatorInterface $translator)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
$this->queue = $queue;
|
||||
|
|
|
@ -8,12 +8,11 @@
|
|||
<div id="header-navigation" class="Header-navigation"></div>
|
||||
<div class="container">
|
||||
<h1 class="Header-title">
|
||||
<a href="{{ array_get($forum, 'baseUrl') }}">
|
||||
<?php $title = array_get($forum, 'title'); ?>
|
||||
@if ($logo = array_get($forum, 'logoUrl'))
|
||||
<img src="{{ $logo }}" alt="{{ $title }}" class="Header-logo">
|
||||
<a href="{{ $forum['baseUrl'] }}">
|
||||
@if ($forum['logoUrl'])
|
||||
<img src="{{ $forum['logoUrl'] }}" alt="{{ $forum['title'] }}" class="Header-logo">
|
||||
@else
|
||||
{{ $title }}
|
||||
{{ $forum['title'] }}
|
||||
@endif
|
||||
</a>
|
||||
</h1>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{!! array_get($forum, 'headerHtml') !!}
|
||||
{!! $forum['headerHtml'] !!}
|
||||
|
||||
<div id="app" class="App">
|
||||
|
||||
|
@ -10,11 +10,11 @@
|
|||
<div id="header-navigation" class="Header-navigation"></div>
|
||||
<div class="container">
|
||||
<h1 class="Header-title">
|
||||
<a href="{{ array_get($forum, 'baseUrl') }}" id="home-link">
|
||||
@if ($logo = array_get($forum, 'logoUrl'))
|
||||
<img src="{{ $logo }}" alt="{{ array_get($forum, 'title') }}" class="Header-logo">
|
||||
<a href="{{ $forum['baseUrl'] }}" id="home-link">
|
||||
@if ($forum['logoUrl'])
|
||||
<img src="{{ $forum['logoUrl'] }}" alt="{{ $forum['title'] }}" class="Header-logo">
|
||||
@else
|
||||
{{ array_get($forum, 'title') }}
|
||||
{{ $forum['title'] }}
|
||||
@endif
|
||||
</a>
|
||||
</h1>
|
||||
|
@ -39,4 +39,4 @@
|
|||
|
||||
</div>
|
||||
|
||||
{!! array_get($forum, 'footerHtml') !!}
|
||||
{!! $forum['footerHtml'] !!}
|
||||
|
|
Loading…
Reference in New Issue
Block a user