mirror of
https://github.com/archtechx/gloss.git
synced 2025-12-12 03:04:04 +00:00
Resolve translator when resolving Gloss
This commit is contained in:
parent
b30c68ddd9
commit
f425a99014
1 changed files with 4 additions and 7 deletions
|
|
@ -5,20 +5,17 @@ declare(strict_types=1);
|
||||||
namespace Lean\Gloss;
|
namespace Lean\Gloss;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Translation\Translator;
|
||||||
|
|
||||||
class GlossServiceProvider extends ServiceProvider
|
class GlossServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
$this->app->singleton(Gloss::$containerKey, function ($app) {
|
$this->app->singleton(Gloss::$containerKey, function ($app) {
|
||||||
$loader = $app['translation.loader'];
|
/** @var Translator $translator */
|
||||||
|
$translator = $app['translator'];
|
||||||
|
|
||||||
// When registering the translator component, we'll need to set the default
|
$trans = new GlossTranslator($translator->getLoader(), $translator->getLocale());
|
||||||
// locale as well as the fallback locale. So, we'll grab the application
|
|
||||||
// configuration so we can easily get both of these values from there.
|
|
||||||
$locale = $app['config']['app.locale'];
|
|
||||||
|
|
||||||
$trans = new GlossTranslator($loader, $locale);
|
|
||||||
|
|
||||||
$trans->setFallback($app['config']['app.fallback_locale']);
|
$trans->setFallback($app['config']['app.fallback_locale']);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue