Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Aiheen aloitti: Teunel - huhtikuu 15, 2007, 12:15:07 IP

Otsikko: Automatic language detection?
Kirjoitti: Teunel - huhtikuu 15, 2007, 12:15:07 IP
I'm planning on creating an international forum, for users from all over the world. Is there some mod available that checks for the language settings on the user's browser, and shows that language on my forum?

:)
Thanks
Otsikko: Re: Automatic language detection?
Kirjoitti: klumy - huhtikuu 15, 2007, 02:21:14 IP
sounds to be a good idea to me ;)
Otsikko: Re: Automatic language detection?
Kirjoitti: Technological Deep - elokuu 07, 2007, 05:41:03 AP
This is simple =)
I will not create mod this time, becourse changes that should be made is very specific...

First of all.... modification target is Settings.php... so there are security risks to make mod....

Here goes necessary steps:
Of course if you wish, you can change default board language to anything else, for example:
switch($locale) {
default    : $language = 'russian'; break; # Default board language
case('es') : $language = 'spanish'; break; # Spanish
}
If you don't know what sends your browser to site in HTTP_ACCEPT_LANGUAGE you can create simple php-file, that contains:
<?php
echo(getenv("HTTP_ACCEPT_LANGUAGE"));
?>

Good luck in programming =)

P.S.
Of course this only will work for first time this user opens forum, becourse language information stores in cookies