Changing forum language on-the-fly

mgl

Member
Hello,

I want to change the forum language whenever there is a specific GET parameter. I've tried something like this:

PHP:
public static function Visitor(XenForo_Visitor &$visitor)
{

.......

if (@$_GET['lang']=="y") {
$visitor->setVisitorLanguage(3);
XenForo_Helper_Cookie::setCookie('language_id', 3, 86400 * 365);
}

....
}

But only the initial page changes the language, if I navigate to another page without the GET parameter, the language goes back to default even though I set the language_id cookie. Is there another way of doing this besides setting my own language cookie and checking for it on every request?


Thank you.
 
Top Bottom