• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Changing forum language on-the-fly


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

public static function Visitor(XenForo_Visitor &$visitor)


if (@$_GET['lang']=="y") {
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.