Adding multilanguage support

Hi, I need some help creating multilanguage support in my application.

First of all I have created a languagefile - messages/sv/app.php.




return array(

    'model.model_name.name' => 'namn',

);



config/main.php




'sourceLanguage'=>'00',

'language'=>'sv',



and this is in the model:




public function attributeLabels()

	{

		return array(

			'name'=>Yii::t('app','model.model_name.name'),

		);

	}



This code works but how can I create a link for the user to change language?

I tried these guides to change language with sessions:

http://www.yiiframework.com/wiki/26/setting-and-maintaining-the-language-in-application-i18n/

http://www.yiiframework.com/wiki/208/how-to-use-an-application-behavior-to-maintain-runtime-configuration/

But I cannot get it to work, am I missing something?

I get an error saying:

"Undefined variable: currentLang"

Maybe there is a simpler solution?