Reputation: 668
I would like to change the locale for all pages on symfony.
I tried this : $req->setLocale('fr');
But when I go to an other page the locale is set as default again.
I know that it is possible to do it with the link "domaine/fr/get" but I don't want to have different links for each languages... :/
I was also wondering if it is possible to set the default locale depending on the ip's country.
Upvotes: 0
Views: 2364
Reputation: 11500
You can do it by Setting the Default Locale.
# app/config/config.yml
framework:
default_locale: fr
To get some advanced control on how to make the Locale Sticky during a user's session or even set the Locale based on IP, you can create a LocaleListener
, which is covered in this cookbook entry.
Upvotes: 1