Switch Language based off Browser/OS setting

Hi, 

Can someone help provide some guidance on how to make boonex default (if available) to the language set in the browser/OS of the user browsing the site?

Thanks

Quote · 17 Apr 2013

On client side: HTTP_ACCEPT_LANGUAGE I don't know how languages are switched in Dolphin; something I have been meaning to learn. Anyway, found the following bit of code; of course it is not useful here but may give a base to work from.

 

<?php
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang){
    case "fr":
        //echo "PAGE FR";
        include("index_fr.php");//include check session FR
        break;
    case "it":
        //echo "PAGE IT";
        include("index_it.php");
        break;
    case "en":
        //echo "PAGE EN";
        include("index_en.php");
        break;       
    default:
        //echo "PAGE EN - Setting Default";
        include("index_en.php");//include EN in all other cases of different lang detection
        break;
}
?>

Geeks, making the world a better place
Quote · 17 Apr 2013

from what I can tell they are switched by simply loading the page with /?lang=fr  or if there is already vars in the url it'll add &lang=fr etc... 

Quote · 17 Apr 2013

Actually Dolphin already parses HTTP_ACCEPT_LANGUAGE header and sets the appropriate language.

You can see this code in getCurrentLangName function in inc/languages.inc.php file.

Rules → http://www.boonex.com/terms
Quote · 18 Apr 2013

oh cool! thanks I had no idea. 

Quote · 18 Apr 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.