Skip to content

Locale not stored in cookie, even it is not executed the onLocaleChange event #212

@wwtvishal

Description

@wwtvishal

Hi,
Please help me with the issue.
I had installed the dependency by executing composer command, I have Lunatics package now in my vendor folder and I did configuration too.
My Config:

lunetics_locale:
    guessing_order:
        - cookie
    allowed_locales:
        - en
        - fr
    guessing_excluded_pattern: ^/admin
    cookie:
        set_on_change: true
    switcher:
        #use_controller: true
        show_current_locale: true
        #use_referrer: true
        redirect_to_route: fallback_route
        redirect_statuscode: 302
    disable_vary_header: true

I added the {{ locale_switcher() }} code to load the template of Locale Switcher.

When I change the language it is changing in URL ?_locale=en or _locale=fr but it is not changing translation even not sonata page as per requested language.

As you can see i set guessing as a cookie but it is not stored in a cookie too, i tryied to debug the event function in lunetics\locale-bundle\Lunetics\LocaleBundle\EventListener LocaleUpdateListener.php

public function onLocaleChange(FilterLocaleSwitchEvent $event)
    {
        echo $this->locale = $event->getLocale();die();
        $this->updateCookie($event->getRequest(), $this->localeCookie->setCookieOnChange());
        $this->updateSession();
    }

but the listener is not calling, I don't know maybe I missed some configuration or anything.

Please help me to solve this problem and hope my site will one in cookie locale instead of default locale always.

Thanks In Advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions