lunetics-org/LocaleBundle

Switcher not working....

Closed this issue · 9 comments

Hi,
i'm quite new to SF 2.1 so i don't know if it's me or a mis-configuration but i can't make the switcher working...

i've added the bundle to my composer.json , updated it, and added it to the appkernel.php

Then i've added to my app/config/config.yml

lunetics_locale:
  guessing_order:
    - cookie
    - router
    - browser
  allowed_locales: %locales%
  cookie:
    set_on_detection: true

with the locales defined in parameters.yml..

Then i've added to my layout.twig
{{ locale_switcher('home_lang') }}

and in my routing.yml

home_lang:
     pattern: /lang/{_locale}
     defaults:
         _controller: lunetics_locale.switcher_controller:switchAction
         _locale: %locale%

I clear my cookies then launch my homepage... LocalBundle correctly take the lang from my browser, but i'm unable to use the switcher ...
When i click on the " Switch to : French , Dutch.... " ... nothing happend ...

i got redirected to the same page with the same locale...

what did i miss?

Thanks for your help

hello, we are curerntly working on this bug

Okay, i added a query guesser (for switching at any route with ?_locale=de)
check #35

I've switch my composer to "lunetics/locale-bundle": "query_guesser-dev",

and it still does not seems to work ....
if i enable my route (home_lang)

i get a

Catchable Fatal Error: Argument 2 passed to Lunetics\LocaleBundle\Validator\LocaleValidator::validate() must be an instance of Symfony\Component\Validator\Constraint, none given, called in /srv/peo/vendor/lunetics/locale-bundle/Lunetics/LocaleBundle/Controller/LocaleController.php on line 43 and defined in /srv/peo/vendor/lunetics/locale-bundle/Lunetics/LocaleBundle/Validator/LocaleValidator.php line 69 

Can you post your complete specs (composer.json), and if possible a complete trace. There seems to be an error with the validator

Thanks a lot for your help!

here are my config files https://gist.github.com/6012542cc3dc59f83b87

the complete stack trace is here :

https://gist.github.com/3938138

hope this will help you... if you need smth else, just ask ;)

please try again with the query_guesser branch

#35

Again thanks for you help, and your quick feedback!

isn'it the case when i put "lunetics/locale-bundle": "query_guesser-dev" in my composer ?
if not , i'll try to change that directly to the vendor dir ... i'll keep you posted

Awesome!
i've update my vendors and to => dev-query_guesser 7a2e767

and it works perfectly!

Thanks for your help ;)
(i close the bug when it's merged into master ?)

merged.