I used this tutorial http://www.yiiframework.com/wiki/208/how-to-use-an-application-behavior-to-maintain-runtime-configuration/ to change language. But I ran into problem that $_Post['lang'] variable is not being reset and every time I try to refresh the page, It gives me form resubmition dialog, which I don't want to have. But I don't know where and how to use redirect, since it doesnt work in behaiours class. How can I prevent this form resubmition?
Edit: I found an ugly solution, to put this code in every view file that I have
<?php
$this->renderPartial('//lang/_refresh', array())
?>
But It involed repeating same code alot and I am sure there is a better solution out there (probably to place a refresh function in the right place)
Found a solution, all you need is to add a beforeAction to components/Controller since all added controllers extend it. The problem was I didn't know that. Here is the function that works so that I dont have to rewrite the code.
protected function beforeAction()
{
if (isset($_POST['lang'])) {
$this->refresh();
}
return true;
}