获取俄罗斯人的日名



我网站上的日常名称为英文。

我如何获得俄语的日常名?

在JavaScript中,我试图在代码中替换周二 ->▪▪▪~~ ~~,但它不起作用。

代码:

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$url = 'http://api.sypexgeo.net/xml/'. $ip .'';
$xml = simplexml_load_string(file_get_contents($url));
$loc_array = array($xml->ip->city->lat,$xml->ip->city->lon);
$loc_safe = array();
foreach($loc_array as $loc){
    $loc_safe[] = urlencode($loc);
}
$loc_string=implode(',', $loc_safe);
$json = file_get_contents('http://api.wunderground.com/api/232323***/satellite/webcams/forecast/q/' . $loc_string . '.json');
$obj = json_decode($json, true);    
?>    
<?
$html .= "</h2><table cellpadding=4 cellspacing=3><tr>";
    foreach ($obj['forecast']['simpleforecast']['forecastday'] as $arr) {
        $html .= "<td align='center'>" . $arr['date']['weekday'] . "<br />";
        $html .= "<img src='http://icons-pe.wxug.com/i/c/k/" . $arr['icon'] . ".gif' border=0 /><br />";
        $html .= "<font color='red'>" . $arr['high']['celsius'] . '&deg;C' . " </font>";
        $html .= "<font color='blue'>" . $arr['low']['celsius'] . '&deg;C' . "</font>";
        $html .= "</td>";    
    }
    $html .= "</tr></table>";
echo $html;
?>

<script type="text/javascript">
window.onload=function(){
//I try, but not replace
$("td:contains('Tuesday')").html("Вторник");      
};
</script>

作为一个选项,您可以更改对Wunderground API的调用。包括语言设置/lang:xy。这样的东西:

https://api-ak-aws.wunderground.com/api/8dee7a0******/satellite/webcams/forecast/lang:RU/units:metric/v:2.0/q/CWEW.json

您可以尝试定义一个JSON对象:

days = { "name of the day": "name of the day in Russian" }

然后而不是使用$arr['date']['weekday']使用days[$arr['date']['weekday']]

注意:我实际上不知道PHP语法,但是类似的东西应该起作用。

最新更新