Multilanguage Setup Without Using Config File

Hi all,

Am using multilanguage in my application, displaying languages in dropdown when i select language am directllay changing language in config file…

[size=“5”][i][b]‘sourceLanguage’ => ‘de’,

‘language’ => ‘en’,


If i change config file, it will affect for all user…so instead of changing config file i need to write language setup in Application.php … But am new to yii, i tried few things its not working.can any one help me pls…

thanks in advance

You shouldn’t be directly changing the config file. I have not worked with i18n, but have seen a number of examples on the web for changing the language for each user.

If you have users login, then you could save the lang preference in the user table and extend WebUser to include the lang pref.

If a generic public site, I would look into Yii::app()->session to save the pref. How and where you would need to set Yii:app()->language, I’m not sure.

Hope this points you in the right direction