Where should I set the User Language

Hello,

First, I’d like to apologize for my English, but it’s not my first language.

I am using Yii to develop a multilingual website. I am using the Yii::t() function and the messages arrays.

I would like to store the prefered language of the user in a cookie, so that the website will be directly in this language.

It is not a problem to store the language in a cookie or change it.

But I would like to know where I could put the Yii::app()->setLanguage() in my code. The language would be the language stored in the user’s cookie, or the default language if it doesn’t exist.

What would be the best practice to do that ? Should I use a filter in a controller (and all of my controllers would extend this customized controller) ?

Thanks a lot !

This wiki article may help.

Thank you very much ! This seems to be exactly what I need !