Closed sbono2016 closed 8 months ago
Hi @sbono2016,
This is weird. I'm not sure the suggested fix is appropriate since you can add your own categories (which are not necessarily defined inside cookieConsent::cookies.categories
). Also, I think it would be interesting to know why the default method didn't work in your case so we can figure out whether there is a problem with your project or with the package itself in a specific setup.
Could you elaborate? Thanks!
Hi, I run into the same situation (mixed locales) and I just want to add some context about translation and the cookie registration process with service provider.
The doc says to register cookies in the boot method of a serviceProvider, but doing that raise a major problem: The locale is probably not already setup, because the boot method is called before any other code of you app (middleware, controller, ...) it will probably fallback to the default locale causing mixed languages to be rendered in the final result.
I would recommend 2 solutions:
@lang
or __
in the blade view and only passing localization keys when registering cookies.Same issue here. The default language of my app is "nl" and when switching to "en", some translations stay in "nl". Most translations come through, but the category title and description and the "defaults" seem to be failing (see images).
I've created a CookieServiceprovider and added this provider as the last provider in my config/app.php. Registering the cookies in the AppServiceProvider doesn't seem to make a difference.
What @QuentinGab mentioned is accurate. Defining cookies while booting Laravel is indeed too ealry, that's why I created PR #29 which is providing a publishable CookiesServiceProvider
responsible for calling the cookies definition at the right moment in Laravel's booting lifecycle.
This will be published as v1.1.0
soon, please upgrade and read the updated "Usage" section in the docs.
I am using 1.2 and did everything in the usage section but keep having this problem. Any ideas?
I am using "codezero/laravel-localized-routes", maybe it has something to do with it? I've dd'd the locale just at the beginning of registerCookies and it still is 'en' when it should be 'de'. I guess I should not define them there but where then? I tried adding the cookies registration to custom middleware but I get the same problem, however when I added to the 'web' group the translations got fixed but now the popup appears each time no matter whether I agree or not to the cookies!!! Baffling. @toonvandenbos
Thank you for the plugin; this is exactly what I was looking for for many weeks.
I encountered a minor issue in the view related to translation.
I had to make some code changes to make it work:"
+- line 37 : From:
To:
The same issue also exists with the cookie description, but I haven't found a way to modify it yet... +- line 48 :