LocaleBundle
LocaleBundle copied to clipboard
Locale not intercepted
Hello, I have a problem like this: I have the routes set this way:
index_not_localized:
path: /
defaults: { _controller: "AcmeSiteBundle:Default:index", _locale: %locale% }
acme_site:
resource: "@AcmeSiteBundle/Controller/"
type: annotation
prefix: /{_locale}/
defaults: { _locale: %locale% }
requirements:
_locale: en|it
if I go to www.example.com is set to the default local and not that of the user. I have configured this way:
guessing_order:
- query
- router
- session
- cookie
- browser
But if imposed as this configuration:
guessing_order:
- session
- cookie
- browser
- query
- router
even if switch to another language does not change the value of the session and cookies. Is there a problem, or I'm wrong configuration? How can I get what I want? thanks
Sorry, I mistakenly sent twice
I have a similar issue...Is it possible that the guessers aren't working?
@Lughino you have to decide if you use stateful or stateless. If a language is found, the guesser exits. So, if query is used at first and the query is guessed via the query guesser, no cookie / session will be set.
Which version of symfony are you using and which version / tag of the localebundle
I hope it's OK if I post here aswell.
lunetics_locale:
allowed_locales:
- en
- sl
- fr
cookie:
set_on_change: true
guessing_order:
- browser
- session
- cookie
- router
- query
From my composer.json:
"lunetics/locale-bundle": "2.2.*"
"symfony/symfony": "2.3.*",
Could you try with master version please?
2013/7/18 jernejpangersic [email protected]
I hope it's OK if I post here aswell.
lunetics_locale: allowed_locales: - en - sl - fr cookie: set_on_change: true guessing_order: - browser - session - cookie - router - query
From my composer.json:
"lunetics/locale-bundle": "2.2." "symfony/symfony": "2.3.",
— Reply to this email directly or view it on GitHubhttps://github.com/lunetics/LocaleBundle/issues/82#issuecomment-21211144 .
EDIT: I added "lunetics/locale-bundle": "dev-master", to composer.json
Unfortunately it still doesn't get the locale from user's browser. I'm trying to get the locale from the browser, without using any {_locale} variables in the URL. Is this possible? Even with using the built in language switcher, it doesn't change the cookie.
is this still relevant? can we close the issue?
I have the same problem. It doesn't write the cookie.
"symfony/symfony": "2.5.", "lunetics/locale-bundle": "2.3."
Same problem. If I switch page, cookie are reset :/ With that {{ locale_switcher() }}, the {{ app.request.locale }} became my selection. But at the page switch, it's back to "normal".
And I have the cookie on change and Cookie/Session/browser as order
cookie:
set_on_change: true
guessing_order:
- cookie
- session
- browser
I have the same problem as you, I investigated in the code, and If i do some echo in the code, the cookie change it value when i use the local_switcher, but not if i dump nothing