F.bernal
F.bernal

Reputation: 2684

Symfony2 locale in urls not working or I am missing something

I have a problem with symfony2 I set the fallback locale to en and default_locale to en .Then I add {_locale} to the routing file. From the controller action called I get the correct locale in the request but there is not performed any translation always use the EN locale.

config.yml:

framework:
#esi:             ~
translator:      { fallback: %locale% }

default_locale:  "%locale%"

parameters.yml:

locale: en

routing.yml

main_homepage:
path:  /{_locale}/
defaults: { _controller: PrincipalMainBundle:Main:index, _locale: en }

I have a messages.es.xlf file with a spanish translation of the site. If I access with http://url.com/es/ in the controller I have the ES locale in the request but NO translation is perfomed.

Any ideas?

Thanks!

Upvotes: 0

Views: 173

Answers (1)

Emii Khaos
Emii Khaos

Reputation: 10085

Maybe a typo in your filename? Should be messages.es.xliff

And don't forget to clear the cache, as new traanslation files are not detected automatically.

Upvotes: 0

Related Questions