This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » How to change the default locale for...
expandshrink

How to change the default locale for a certain siteaccess?

How to change the default locale for a certain siteaccess?

Friday 27 December 2013 12:08:00 pm - 1 reply

Hello, I am trying to test the multilingual feature using symfony2 translation files, please notice that I had no problems translating content objects, the problem here is using the messages.fr.xlf file. So far the only way I found to set the default locale for a certain siteaccess was calling:

 $request->setLocale('fr_FR');

I could try to do this using the PreContentView event, but I would like to know if there is any easier way to do this. Suppose I have 2 siteaccess, english and french, and I have set default_locale as en, but I want to change it to fr when I access the french website, so I can translate the strings in my templates using the messages.fr.xlf translations, how can we do this?

Tuesday 31 December 2013 12:56:51 pm

I have found a solution, it is basically the same idea I was thinking, but instead of using a PreContentView listener I am using an onKernelRequest listener.

Check my blog post: http://share.ez.no/blogs/thiago-campos-viana/ez-publish-5-symfony-2-siteaccess-locale-support

Modified on Tuesday 31 December 2013 1:43:17 pm by Thiago Campos Viana

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from