Skip to content

Persistent Locale #44

@Krato

Description

@Krato

Hi, i just install this package. But I'm a little confused.

I have config/app.php with:

'locale' => 'es',

And config/localization.phpas:

'supported-locales'      => ['en', 'es'],

    'accept-language-header' => true,

    'hide-default-in-url'    => false,

    'facade'                 => 'Localization',

    /* ------------------------------------------------------------------------------------------------
     |  Route
     | ------------------------------------------------------------------------------------------------
     */
    'route'                  => [
        'middleware' => [
            'localization-session-redirect' => true,
            'localization-cookie-redirect'  => false,
            'localization-redirect'         => true,
            'localized-routes'              => true,
            'translation-redirect'          => true,
        ],
    ],

I have and admin panel without routes translates. And In my views if I call dump(\App::getLocale()), allways get en neveres. But es is the default language. If I call dump(\App::getLocale()) in routes.php file shows es.

But If I call Localization::getCurrentLocale()shows correctly es.

My route is for example: blog/new. And Route is not in localization middleware:

Route::group(['prefix' => 'admin', 'middleware' => 'role:admin'], function() 
{
    Route::get('/blog/new', '\App\Blog\Controllers\PostController@create');
});

Why locale is set to en? How can I do it?

Thanks!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions