View Full Version : Solved Auto revert to English if english is profile language

15-12-09, 21:22
I already hide flags from English users via template conditionals, but now I'd like to take this to the next level, as English-speaking users in other countries who have their browser language set to a foreign language, but land on translated pages of our site when searching with google want to automatically view the English versions rather than the translated versions.

In order to do this I have written the following code.

However, as I'm not that familiar with the internal workings of vBET, I don't know where to place it or how to complete it. Could you please help me with this?

if ($_GET['language'] != "en" and $vbulletin->userinfo['vbet_def_lang'] == 'en')
revert language to english

-Which plugin/file would this go into?
-What would I put in place of 'revert language to English'?


15-12-09, 23:46
At this moment user should be automatically redirected to it's default language by vBET. Check it and if not working, then let us know - we will move this thread to bug report. Please note that cookies have to be enabled for this to work (before login there is no info about user, so we set lifetime cookie and when user comes from same browser he is redirected even before login) and it will happen only at the beginning of session (otherwise user would not be able to change language manually).

16-12-09, 01:48
At the beginning of the session, yes, the language is changed.

However, let's say I'm logged in and my default language is English.

Suppose that my browser language is Polish, and when I googled a term, my website came up as a result. Once clicked, I was taken to mysite.com/forum/pl/thread.html. For my purposes, I want the user to automatically be redirected to mysite.com/forum/thread.html if their profile language is english.

Otherwise, people outside of the US who are fluent in English may be taken to translated versions of the site, and, obviously, the auto-translation is worse than the English version for them.

Therefore, if possible, could you please offer some pointers with my above code? I would very much appreciate the help. Thanks very much in advance!

16-12-09, 03:15
I understand your scenario, but it is very uncommon. If someone already is on your site why should he Google it? When someone is not and Google it, then new session is created so he will be redirected.

The reason why we still make discussion (why we do not accept this yet) is because if we made changes as you want, then user will be not able at all to change translation - because he will be always redirected to his default language, even if he click some flag. That is why we made this redirection only at the beginning - because after that user is free to go wherever he wants and to any translation he wants.

Is it really how you would like to behave your forum. And does scenario which you gave is possible in reality. Because in 99.99999% of cases it will work as you desire - if some user will go to you by external link and already have account with default language set, then he will be redirected as you want. And if he has already opened your forum then:
- 1st - why would he go there from other place if he already is there?
- 2nd - even in such uncommon case he can just click flag, because he knows your forum and knows what is going on.

Please consider this. We do not want made our request as official change because of arguments above. But if you really still think that it is good idea for you we will give you some workaround for vBET 3.2.x (in 3.3.0 we changed place of redirections and also made it better for performance).

16-12-09, 03:47
Please, provide me with the workaround.

While your points are quite valid, this scenario was actually encountered by a user and reported to me- see here: PentaxForums.com (http://www.pentaxforums.com/forums/site-suggestions-forum-help/83462-suggestion-translation-annoyances.html#post845743). I do agree that most of the time, this won't be an issue, but I like having my site 100% perfect!

Edit: please log in as testuser, password test, to view the link above. I disabled the news forum from public view for SEO reasons :)

The thing with the workaround is that it would only make it so that English-speaking users can't manually change translations. Via templates, I have already hidden the flags for users who set English in their profile. So, the gist is this- if you want translations, either choose something other than English, or browse the forum as a guest. Hence, I'd like the workaround.

Thanks very much for the consideration, and I'm glad to hear that you're willing to help me in this matter. vBET has been working very well with my site so far and I'm glad to be a customer here!

07-05-10, 15:27
Hi, I found that for some reason this old thread is still not closed. Please tell does it was solved or we accidentally miss it and you still need our help.

09-05-10, 00:34
I've found that it's not necessary to have something like this. Instead, I place this warning in navbar advising the user to change language.

You may now close this thread.

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Translated to other languages thanks to vB Enterprise Translator 4.9.99