PDA

View Full Version : Mini Mods - Set forum-language automatic to browser-language for first-visitors


JoergZ
14 Oct 2006, 19:10
Short-description

This Hack detects the browser-language automatic and shows the board in the language of the user, if the user has never been at your board before or has no cookie for your board.

The part of automatic-detection of the browser-language was realised by WildChild


Requirements

vB 3.6 (Tested with 3.6.2)
Of course more than one installed and selectable language, otherwise this modification makes no sense ;)Installation-time

about 1 minutes


PLEASE CLICK THE INSTALL BUTTON IF INSTALLED! :)


------------------------------------------------------------------------

If you want to test the hack after installing, do it like this:

- Log out of your forum. Dont klick any of the displayed links after logging out !
- Close your browser-window
- Open a new browser-window
- Set your language preferences in the browser
- Go to your forum homepage

Klaymen TK
14 Oct 2006, 19:38
Really really great! Thanks man!

*Installed*

Robru
14 Oct 2006, 21:12
Marvelous hack, thank you :)

Ajavas
15 Oct 2006, 17:55
Thanks nice modification. :)

**Installed**

oberheimhaven
16 Oct 2006, 00:40
will this work 3.6.0 thxs m8 great hack also i couldnt find her after install to check her in adminp
thxs
MArkAnthony

nope nothing?? Im missing something here correct??

JoergZ
16 Oct 2006, 06:56
I have not tested it with 3.6.0, but it works for all 3.5.x versions and for 3.6.2, so it should work for 3.6.0 and 3.6.1 too.

After you have installed the plugin, there will be not new points in the settings. You have to go to the plugin-area and edit the plugin-code direct. So click on "Plugins & Products" in the left menue in the Admin-CP, then select "Plugin Manager".

There you click on "Edit" at the plugin "Set automatic forumlanguage to browserlanguage". To have a better overview increase the size of the edit-box 3 or 4 times. Scroll to the end of the plugin-code. There you find direct above the edit-description the lines, where you can assign the language-code to your language ID.

If you still have problems to find it, I can provide some screenshots.


Best regards

Jörg

oberheimhaven
16 Oct 2006, 11:59
I have not tested it with 3.6.0, but it works for all 3.5.x versions and for 3.6.2, so it should work for 3.6.0 and 3.6.1 too.

After you have installed the plugin, there will be not new points in the settings. You have to go to the plugin-area and edit the plugin-code direct. So click on "Plugins & Products" in the left menue in the Admin-CP, then select "Plugin Manager".

There you click on "Edit" at the plugin "Set automatic forumlanguage to browserlanguage". To have a better overview increase the size of the edit-box 3 or 4 times. Scroll to the end of the plugin-code. There you find direct above the edit-description the lines, where you can assign the language-code to your language ID.

If you still have problems to find it, I can provide some screenshots.


Best regards

Jörg
Ok I found what are we suppose to do to get this to work tho????? I have installed is there suppose to be a drop down menu? anything I aint getting it??

uspange
16 Oct 2006, 13:30
Ok I found what are we suppose to do to get this to work tho????? I have installed is there suppose to be a drop down menu? anything I aint getting it??

1.) Open Admin Panel
2.) Check Languages (with my board German is ID1 and English ID2)
3.) Go Plugins & Products
4.) Manage Plugins
5.) Click "edit" for "Set automatic forumlanguage to browserlanguage"
6.) Check code at the end. If you only run German and English, you might want to delete French or set it to German/English.

Do your testing with your browser, delete cookies and stuff ...

JoergZ
16 Oct 2006, 19:39
I have installed is there suppose to be a drop down menu?

No, there is no visible change. Please look at the top, there is the short-description what this hack do.

To give an example:

You have installed the following languages on your board: English, German, French.

A visitor, that has never been bevore on your forum comes to your website with the board. Without any modification the user see the board in the language, you have defined as default. Let's say English. To change the language the user has to select it from the drop-down menu at the bottom.

With this hack, a first-time visitor from France would see the board immedeately in French, without changing the language manually.

That's what the hack is doing.

How you set the hack correct to the languages you have installed, is described in the downloadable installation-description.

How to get there, has uspange described in the post above very good.


BR

Jörg

oberheimhaven
17 Oct 2006, 04:03
thxs mates great hack!!!!1

Greek76
18 Oct 2006, 10:39
I installed but doesnt seem to work. Where it says x or xx I forget I replaced it with the language I would like. I added tha language on my browser did what you said but no good. Any ideas?

JoergZ
18 Oct 2006, 10:54
Hi Greek76 !

The only idea I have is the following: After you have added a different language-preferenz to your browser, have you changed the order, so the new language is on top ?

And it is important, that you logout from your board, and do not click anything after logging out, otherwise again a cookie would be set. So logout, and then close the browser window, then start your browser again.

What browser are you using ? I admit, I have tested it only with IE 6.0. But it should work with all browsers.


Best regards

Jörg

lapinkulta
19 Oct 2006, 15:38
wonderfull hack, very usefull.

one question: can i assign a specific style together with the language? will this work also for guests or for users only?

greetings,
lapinkulta

JoergZ
19 Oct 2006, 19:06
one question: can i assign a specific style together with the language? will this work also for guests or for users only?

Never thought about that. I will check this. If it works, then it would be also only for first-time visitors with no cookie. The user is always able to change the style.


BR

Jörg

lapinkulta
19 Oct 2006, 20:44
yes, would be nice for replacement variables in different languages. i am using something like that which works only for logged in users, not for guests:


if ($_SERVER['HTTP_HOST'] == "en.domain.com") {
$_REQUEST['langid'] = 3;
$_REQUEST['styleid'] = 4;
} elseif ($_SERVER['HTTP_HOST'] == "de.domain.com") {
$_REQUEST['langid'] = 2;
$_REQUEST['styleid'] = 3;
} else {
$_REQUEST['langid'] = 16;
$_REQUEST['styleid'] = 5;
}

localrelax
22 Dec 2006, 14:48
Thanks, it works on 3.6.4

domainsTRADER
27 Dec 2006, 08:36
tanks nice idea

bjhuang
06 Jun 2007, 20:50
can not change language settings from control panel after installed.

zhaoke
12 Oct 2007, 23:47
This sounds great, but it not works on 3.6.8, the below is my settings:
(i checked language code settings, zh-cn_id: 11, en-US_id: 1)

$_DLANG='en-US';

'en-US', # english.
'zh-cn' # chinese.

case 'en-US':
$_REQUEST['langid'] = 1;
break;
case 'zh':
$_REQUEST['langid'] = 11;
break;

Kirauni
02 Nov 2007, 22:30
*installed this add-on*

It works fine on my vBulletin 3.6.8.
However, I had to delete all my browser's temporary files, cookies etc.
Right after this I switched my browser's language and then it worked perfectly.

Thank you very much for this nice hack, it makes browsing a multilingual board as a guest much easier.

JAnders
15 Feb 2008, 20:08
I just installed it in version 3.5.8 the xml didn't work but I made a simple modification to the xml reuploaded and worked no problem.

if anyone wants this mod and can't get it to work in v 3.5 i can give you the moded xml

btw thanks for the hack it was exactly what I was looking for

masterweb
15 Feb 2008, 20:40
it works on 3.6.8 with a custom style?

JoergZ
15 Feb 2008, 21:22
I just installed it in version 3.5.8 the xml didn't work but I made a simple modification to the xml reuploaded and worked no problem.

if anyone wants this mod and can't get it to work in v 3.5 i can give you the moded xml

btw thanks for the hack it was exactly what I was looking for


The change was not necessray, because there is a 3.5 Version (http://www.vbulletin.org/forum/showthread.php?t=97261) too.

Moreover it would have beend nice to ask me before you offer your modified version to others ;)




it works on 3.6.8 with a custom style?

The style doesn't matter.



Jörg

yeku
16 Feb 2008, 03:41
My forum is in Spanish, does this hack not work?

thank

JoergZ
16 Feb 2008, 09:58
To give you some help I need more information. Which languages do you have installed ? Is the board public where you have installed the hack ? If so, then please send me the link via PM, so I can have a look on your site.

Jörg

yeku
16 Feb 2008, 16:36
Ok Jörg:

My forum is in English, the base. I have translated text into Spanish, I do not have once no hack of language was installed.


Thanks

JoergZ
16 Feb 2008, 17:35
Hi yeku !

It is not a good idea to post user and pw public. :) I changed the password of the user.

As far as I see, you don't offer different languages to choose. But that's a condition for using the hack.

You have to install different language-packages and have to make them user-selectable. Then the hack will automatic change to the fitting language for guest.

Jörg

yeku
16 Feb 2008, 18:12
Hello!!!

No matter, himself I do that, I have the controlled theme, in any case thanks.

I will install several hack of languages

thank

Fraxter
26 May 2008, 23:17
Can anyone update this great addon to vbulletin 3.7? It´s not working for me there. :(

JoergZ
27 May 2008, 21:57
I am sorry, but currently I have no time to work on hacks.

If anyone want to modify this hack, so it works with 3.7 ,feel free to do it.


Best regards

Joerg

bongwater
24 Jun 2008, 19:35
seems to work fine for our forum, and we are on 3.7.2

JoergZ
24 Jun 2008, 19:41
Nice to hear.

Then Pander23 maybe did something wrong.. ;)


Joerg

Datenpapst
18 Feb 2009, 09:24
Fatal error: Cannot redeclare rk_getenvvar() (previously declared in /var/www/vhosts/c-arena.com/subdomains/forum/httpdocs/includes/init.php(298) : eval()'d code:63) in /var/www/vhosts/c-arena.com/subdomains/forum/httpdocs/includes/init.php(298) : eval()'d code on line 266

is coming when I install this on 3.8.1

JoergZ
02 Mar 2009, 10:11
Sorry, as you can see in the top, it is only tested and approved up to 3.6.2

Due to lack of time, I have currently no plans to bring it to 3.8.x. Sorry

Best regards

Joerg

snoopy5
20 Jun 2009, 07:59
Hi

could anybody adjust this great mod for vb 3.8x?

Or does anybody knows a similar hack. I absolutely need this automatic browser language detection!

snoopy5
29 Jun 2009, 14:00
FYI

I tested this now on a vb installation version 3.80 and 3.83. It works in both of them. I have not seen yet any errors or incompatibilities.

Great mod!

JoergZ
29 Jun 2009, 14:51
Hi snoopy5,

thank you very much for your feedback. I am lucky to hear it is working with 3.8


Joerg

snoopy5
29 Jun 2009, 17:28
Hi

I tried it now on a third installation, but it seems that I tried accidentally to upload it twice. Now I get an error.

I disabled all plugins in config.php, so that I have access again the ACP.

But how do I delete this plugin now properly, so that I can try to install it again?

snoopy5
29 Jun 2009, 17:51
update:

I found it. It was under a different section of the plugin options within ACP.

So I deleted it and installed it again. This time no error. BUT it does not recognize the browser language and I do not know why. The settings are the exact same as with the other 2 installations.

What could be the reason for this? I deleted already in FF cookies etc.

snoopy5
29 Jun 2009, 18:28
update:

I found it. It was under a different section of the plugin options within ACP.

So I deleted it and installed it again. This time no error. BUT it does not recognize the browser language and I do not know why. The settings are the exact same as with the other 2 installations.

What could be the reason for this? I deleted already in FF cookies etc.

JoergZ
29 Jun 2009, 19:25
Have you double-checked the lines, where you define your installed languages ?



case 'en':
$_REQUEST['langid'] = 1;
break;
case 'de':
$_REQUEST['langid'] = 2;
break;
case 'fr':
$_REQUEST['langid'] = 3;
break;



Check if the id is equal to your language-id in the forum.

snoopy5
29 Jun 2009, 19:40
That was the solution.

The ID for the other language was in this "problem installation" 3 and not 2 as in all the other installations. Do not ask me why it is here different (I only have 2 languages installed anyway).

So it was the ID numbers 1 and 3 and not 1 and 2 like with the other vb forums.

Now it works

Thanks

JoergZ
29 Jun 2009, 19:44
That can happen, when you install a language, remove it, and install it again. Every new language-installation gets a new id.

I am glad, that it is working now.

Br

Joerg

Zillo
13 Mar 2010, 16:59
Is this working with vBulletin 4? Otherwise do you know a similar addon for vb4? Thanks

JoergZ
15 Mar 2010, 10:45
Hi Zillo,

I absolutely doubt it, that it is working for vB 4.

If I have time to check it and maybe modify it for vB4 I will let you know.


Best regards

Joerg

Datenpapst
23 May 2010, 12:34
Any chance to get this for vb4?
This version does not work on the newest version.

Warning: Invalid argument supplied for foreach() in [path]/includes/init.php(331) : eval()'d code on line 122

Warning: Invalid argument supplied for foreach() in [path]/includes/init.php(331) : eval()'d code on line 127

Warning: Invalid argument supplied for foreach() in [path]/includes/init.php(331) : eval()'d code on line 132


Unable to add cookies, header already sent.
File: /var/www/vhosts/c-arena.com/httpdocs/includes/class_core.php
Line: 4495

JoergZ
23 May 2010, 15:38
Yes, it's already done. :) I only did not found the time yet to upload it here.

But I will do so today or tomorrow evening.

So check back.


Br

Joerg

JoergZ
24 May 2010, 15:14
The version for vB4 is now available here: http://www.vbulletin.org/forum/showthread.php?t=243201


Joerg