Page 1 of 1

Multiple localizations mod

Posted: Sat May 08, 2010 1:09 pm
by Gabberkooij
/*************************************
Title: Multiple localizations
Version: 1.7
Author: Martijn van der Kooij
Demo:
Download:
Website: http://www.pecsforall.com/gbook/gbook.php

Short description: I wanted to show the user with different languages depending on their browser settings. I came up with the following

*************************************/

In Settings.php remove

Code: Select all

$settings['spam_question']='Type <b>ABCDE</b> below to show you are not a robot:';
In Settings.php replace

Code: Select all

/* Language file */
    $settings['language']='language.inc.php';
with

Code: Select all

/* Language file */
if (strpos(" ". $_SERVER["HTTP_ACCEPT_LANGUAGE"], "nl")>0){ 
    $settings['language']='language_nl.inc.php';
    $settings['spam_question']='Type <b>ABCDE</b> hieronder om aan te tonen dat u geen robot bent:';
}else if (strpos(" ". $_SERVER["HTTP_ACCEPT_LANGUAGE"], "bg")>0){ 
    $settings['language']='language_bg.inc.php';
//}else if (strpos(" ". $_SERVER["HTTP_ACCEPT_LANGUAGE"], "sv")>0){ 
//    $settings['spam_question']='Type <b>ABCDE</b> below to show you are not a robot:';
//    $settings['language']='language_sv.inc.php';
}else if (strpos(" ". $_SERVER["HTTP_ACCEPT_LANGUAGE"], "fr")>0){ 
    $settings['spam_question']='Type <b>ABCDE</b> below to show you are not a robot:';
    $settings['language']='language_fr.inc.php';
}else if (strpos(" ". $_SERVER["HTTP_ACCEPT_LANGUAGE"], "es")>0){ 
    $settings['spam_question']='Escribe <b>ABCDE</b> debajo para comprobar que no eres un robot:';
    $settings['language']='language_es.inc.php';
}else if (strpos(" ". $_SERVER["HTTP_ACCEPT_LANGUAGE"], "it")>0){ 
    $settings['spam_question']='Type <b>ABCDE</b> below to show you are not a robot:';
    $settings['language']='language_it.inc.php';
}else if (strpos(" ". $_SERVER["HTTP_ACCEPT_LANGUAGE"], "de")>0){ 
    $settings['spam_question']='Type <b>ABCDE</b> below to show you are not a robot:';
    $settings['language']='language_de.inc.php';
}else if (strpos(" ". $_SERVER["HTTP_ACCEPT_LANGUAGE"], "ru")>0){ 
    $settings['spam_question']='Type <b>ABCDE</b> below to show you are not a robot:';
    $settings['language']='language_ru.inc.php';
}else{
    $settings['spam_question']='Type <b>ABCDE</b> below to show you are not a robot:';
    $settings['language']='language.inc.php';  // the default is en
}
And make sure you have the latests versions of the langugae files from the other Mods

I'm also working on a French translation (well, somebody else does it for me :-) )
Some of the uestions needs a translations, so feel free to add a message with the proper translation....