PDA

View Full Version : detect forum/language to change language


bhon
03-03-2012, 10:48 AM
My forum is mainly targeted for arabic speakers which is a RTL language therefore the default language and interface is Arabic but recently we are thinking of creating subforums in different languages the current one will be in English.

The problem is threads in that forum would not have a good presentation for visitors unless the language is changed to English and the oriantation of writing to be changed from Arabic to English.

I want to place something similar in the template to check which forum this thread or the visitor in and check the language if it saticfies that certain condation the language will be automatically changed.

How can I do that?

<vb:if condition="$langid=='1'" AND forumid='32'>
$langid=1
</vb:if>

BirdOPrey5
03-05-2012, 11:35 AM
Good luck... I spent many an hour trying to get this to work once- but languages don't behave like styles (which can be easily changed) in my experience. I never got it working.

First it needs to be a plugin, not a template conditional, so <vb:if...> is the wrong type of code;

I would have thought something like this on global_bootstrap_init_start would work:


global $vbulletin;

if ($GLOBALS['forumid'] == 32)
{
$vbulletin->userinfo['languageid'] = 1;
}



and a bunch of variations on that, but never got it right.