66 lines
1.4 KiB
PHP
66 lines
1.4 KiB
PHP
<?php
|
|
if (isset($_GET["lang"]))
|
|
$lang = $_GET["lang"];
|
|
else
|
|
{
|
|
$lang = preg_split ('[,;]',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
$lang = substr($lang[0],0,2);
|
|
}
|
|
|
|
switch($lang)
|
|
{
|
|
case "fr":
|
|
setlocale (LC_ALL, 'fr_FR.ISO8859-1');
|
|
//setlocale (LC_ALL, 'fr_FR@euro');
|
|
break;
|
|
case "es":
|
|
setlocale (LC_ALL, 'es_ES.ISO8859-1');
|
|
//setlocale (LC_ALL, 'es_ES@euro');
|
|
break;
|
|
case "eo":
|
|
setlocale (LC_ALL, 'eo_EO.UTF-8');
|
|
break;
|
|
default:
|
|
setlocale (LC_ALL, 'en');
|
|
$lang = "en";
|
|
}
|
|
|
|
function long_date($timestamp,$lang)
|
|
{
|
|
switch ($lang)
|
|
{
|
|
case "fr":
|
|
setlocale (LC_ALL, 'fr_FR.ISO8859-1');
|
|
$datestring = strftime("%A %e %B %Y",$timestamp)." à ".strftime("%R",$timestamp);
|
|
break;
|
|
case "es":
|
|
$datestring = strftime("%A, %e de %B, %Y",$timestamp)." a las ".strftime("%R",$timestamp);
|
|
break;
|
|
case "eo":
|
|
setlocale (LC_TIME, 'eo_EO.UTF-8');
|
|
$datestring = strftime("%A, %e de %B, %Y",$timestamp)." a las ".strftime("%R",$timestamp);
|
|
break;
|
|
default:
|
|
$datestring = date("l, \\t\h\e jS \\of F, Y",$timestamp)." at ".strftime("%I:%M %p",$timestamp);
|
|
}
|
|
|
|
return $datestring;
|
|
}
|
|
|
|
function short_date($timestamp,$lang)
|
|
{
|
|
switch($lang)
|
|
{
|
|
case "fr":
|
|
$datestring = strftime("%d/%m/%y",$timestamp);
|
|
break;
|
|
case "es":
|
|
$datestring = strftime("%d/%m/%y",$timestamp);
|
|
break;
|
|
default:
|
|
$datestring = strftime("%m/%d/%y",$timestamp);
|
|
}
|
|
|
|
return $datestring;
|
|
}
|
|
?>
|