PDA

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


JoergZ
10-13-2006, 10:00 PM
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
10-14-2006, 05:38 PM
Really really great! Thanks man!

*Installed*

Robru
10-14-2006, 07:12 PM
Marvelous hack, thank you :)

Ajavas
10-15-2006, 03:55 PM
Thanks nice modification. :)

**Installed**

oberheimhaven
10-15-2006, 10:40 PM
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
10-16-2006, 04:56 AM
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
10-16-2006, 09:59 AM
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
10-16-2006, 11:30 AM
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
10-16-2006, 05:39 PM
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
10-17-2006, 02:03 AM
thxs mates great hack!!!!1

Greek76
10-18-2006, 08:39 AM
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
10-18-2006, 08:54 AM
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
10-19-2006, 01:38 PM
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
10-19-2006, 05:06 PM
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
10-19-2006, 06:44 PM
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
12-22-2006, 12:48 PM
Thanks, it works on 3.6.4

domainsTRADER
12-27-2006, 06:36 AM
tanks nice idea

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

zhaoke
10-12-2007, 09:47 PM
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
11-02-2007, 08:30 PM
*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
02-15-2008, 06:08 PM
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
02-15-2008, 06:40 PM
it works on 3.6.8 with a custom style?

JoergZ
02-15-2008, 07:22 PM
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 (https://vborg.vbsupport.ru/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
02-16-2008, 01:41 AM
My forum is in Spanish, does this hack not work?

thank

JoergZ
02-16-2008, 07:58 AM
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
02-16-2008, 02:36 PM
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
02-16-2008, 03:35 PM
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
02-16-2008, 04:12 PM
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
05-26-2008, 09:17 PM
Can anyone update this great addon to vbulletin 3.7? It?s not working for me there. :(

JoergZ
05-27-2008, 07:57 PM
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
06-24-2008, 05:35 PM
seems to work fine for our forum, and we are on 3.7.2

JoergZ
06-24-2008, 05:41 PM
Nice to hear.

Then Pander23 maybe did something wrong.. ;)


Joerg

Datenpapst
02-18-2009, 07:24 AM
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
03-02-2009, 08:11 AM
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
06-20-2009, 05:59 AM
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
06-29-2009, 12:00 PM
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
06-29-2009, 12:51 PM
Hi snoopy5,

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


Joerg

snoopy5
06-29-2009, 03:28 PM
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
06-29-2009, 03:51 PM
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
06-29-2009, 04:28 PM
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
06-29-2009, 05:25 PM
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
06-29-2009, 05:40 PM
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
06-29-2009, 05:44 PM
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
03-13-2010, 02:59 PM
Is this working with vBulletin 4? Otherwise do you know a similar addon for vb4? Thanks

JoergZ
03-15-2010, 08:45 AM
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
05-23-2010, 10:34 AM
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
05-23-2010, 01:38 PM
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
05-24-2010, 01:14 PM
The version for vB4 is now available here: https://vborg.vbsupport.ru/showthread.php?t=243201


Joerg