Exemplo n.º 1
0
    return $default;
}
$dir = "lang/chat";
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        $x = 0;
        while (($file = readdir($dh)) !== false) {
            if ($file != "." && $file != "..") {
                $langFiles[$x] = basename($file, ".php");
            }
            $x++;
        }
        closedir($dh);
    }
}
$langFile = get_client_language($langFiles, $chat_settings["defaultLang"]);
include "lang/chat/" . $langFile . ".php";
// Template File Loader
include "includes/smarty/Smarty.class.php";
$smarty = new Smarty();
if (isset($templates_compiledir)) {
    $smarty->compile_dir = $templates_compiledir;
}
if ($_POST["action"] == "post") {
    $smarty->assign("displayMessage", $posted);
}
$smarty->assign("uid", $uid);
$smarty->assign("user", $user);
$smarty->assign("LANG", $_LANG);
$smarty->assign("SESSION", $_SESSION);
$smarty->display("chat/" . $chat_settings["template"] . "/leavemessage.tpl");
Exemplo n.º 2
0
	// Lang
<?php 
function get_client_language($default = 'en')
{
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        // C : fr,fr-FR;q=0.8,en-US;q=0.6,en;q=0.4
        // F : fr-fr,fr;q=0.8,en;q=0.5,en-us;q=0.3
        $langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
        foreach ($langs as $value) {
            $choice = substr($value, 0, 2);
            return $choice;
        }
    }
    return $default;
}
echo "lang = '" . get_client_language() . "'\n";
?>

// Images languages
langs = {} ;
<?php 
foreach ($langs as $code => $lang) {
    echo "langs['{$code}'] = '{$lang}' ; \n";
}
?>
// Images default
if ( ( lang != 'en' ) && ( langs[lang] ) ) // Browser's language exists in languages
	cardimages_default_lang = 'http://img.mogg.fr/'+lang.toUpperCase()+'/'
else
	cardimages_default_lang = cardimages_default ;