Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wwtvishal opened this issue Mar 25, 2020 · 0 comments

Comments

@wwtvishal
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant