(求助)winterboard 主題天氣中文化問題,請大大幫忙看一下

如題各位大大,可否麻煩協助看看,主題如下圖
天氣英文說明部份如何中文化?爬了很多文還是搞不懂,希望能協助小弟。
天氣設定檔如附件。
(求助)winterboard 主題天氣中文化問題,請大大幫忙看一下

檔案上傳失敗以貼文方式,如下:weather.js

var useRealFeel = false;
var stylesheet = 'mini'
var iconSet = 'vclouds'
var iconExt = '.png'
var source = 'yahooWeather'
var updateInterval = 15
var postal;
var MiniIcons =
[
"0", //0 tornado
"1", //1 tropical storm
"2", //2 hurricane
"3", //3 severe thunderstorms
"4", //4 thunderstorms
"5", //5 mixed rain and snow
"6", //6 mixed rain and sleet
"7", //7 mixed snow and sleet
"8", //8 freezing drizzle
"9", //9 drizzle
"10", //10 freezing rain
"11", //11 showers
"12", //12 showers
"13", //13 snow flurries
"14", //14 light snow showers
"15", //15 blowing snow
"16", //16 snow
"17", //17 hail
"18", //18 sleet
"19", //19 dust
"20", //20 foggy
"21", //21 haze
"22", //22 smoky
"23", //23 blustery
"24", //24 windy
"25", //25 cold
"26", //26 cloudy
"27", //27 mostly cloudy (night)
"28", //28 mostly cloudy (day)
"29", //29 partly cloudy (night)
"30", //30 partly cloudy (day)
"31", //31 clear (night)
"32", //32 sunny
"33", //33 fair (night)
"34", //34 fair (day)
"35", //35 mixed rain and hail
"36", //36 hot
"37", //37 isolated thunderstorms
"38", //38 scattered thunderstorms
"39", //39 scattered thunderstorms
"40", //40 scattered showers
"41", //41 heavy snow
"42", //42 scattered snow showers
"43", //43 heavy snow
"44", //44 partly cloudy
"45", //45 thundershowers
"46", //46 snow showers
"47", //47 isolated thundershowers
"dunno", //3200 not available
]





function enableWeather() {
document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"na"+iconExt;
validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)
};

function setPostal(obj) {
if (obj.error == false){
if(obj.cities.length > 0){
postal = escape(obj.cities[0].zip).replace(/^%u/g, "%")
document.getElementById("WeatherContainer").className = "";
weatherRefresherTemp();
}
else {
document.getElementById("WeatherContainer").className = "errorLocaleNotFound";
}

}
else {
document.getElementById("WeatherContainer").className = "errorLocaleValidate";
setTimeout('validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)', Math.round(1000*60*5));
}
};


function dealWithWeather(obj) {
if (obj.error == false){

if(useRealFeel == true){
tempValue = convertTemp(obj.realFeel);
}
else {
tempValue = convertTemp(obj.temp)
}

var xl = convertTemp(obj.plus1low);
var xxl = convertTemp(obj.plus2low);
var xxxl = convertTemp(obj.plus3low);
var xxxxl = convertTemp(obj.plus4low);
var xh = convertTemp(obj.plus1high);
var xxh = convertTemp(obj.plus2high);
var xxxh = convertTemp(obj.plus3high);
var xxxxh = convertTemp(obj.plus4high);


document.getElementById("temp")[removed]=tempValue+ "°";
document.getElementById("lowhigh")[removed]="低溫: "+convertTemp(obj.plus0low)+ "° / 高溫: "+convertTemp(obj.plus0high)+ "°";


document.getElementById("tempplus2day")[removed] = '' + longform(obj.plus1day) + '
' +
obj.plus1text + '
' + xl + '° | ' + xh + '°';

document.getElementById("tempplus3day")[removed] = '' + longform(obj.plus2day) + '
' +
obj.plus2text + '
' + xxl + '° | ' + xxh + '°';

document.getElementById("tempplus4day")[removed] = '' + longform(obj.plus3day) + '
' +
obj.plus3text + '
' + xxxl + '° | ' + xxxh + '°';

document.getElementById("tempplus5day")[removed] = '' + longform(obj.plus4day) + '
' +
obj.plus4text + '
' + xxxxl + '° | ' + xxxxh + '°';


document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+MiniIcons[obj.icon]+iconExt;
document.getElementById("WeatherContainer").className = "";

document.getElementById("city")[removed] = obj.city;
document.getElementById("condition")[removed] = obj.condition;

}else{
document.getElementById("WeatherContainer").className = "errorWeatherDataFetch";
}
};

function weatherRefresherTemp() {
fetchWeatherData(dealWithWeather,postal);
setTimeout(weatherRefresherTemp, 60*1000*updateInterval);
};

function constructError (string) {
return {error:true, errorString:string};
};

function findChild (element, nodeName) {
var child;

for (child = element.firstChild; child != null; child = child.nextSibling) {
if (child.nodeName == nodeName)
return child;
}

return null;
};

function fetchWeatherData (callback, zip) {
url="http://xml.weather.yahoo.com/forecastrss/" //u=Farenheit, because accuWeather sucks
var xml_request = new XMLHttpRequest();
xml_request.onload = function(e) {xml_loaded(e, xml_request, callback);}
xml_request.overrideMimeType("text/xml");
xml_request.open("GET", url+zip+".xml");
xml_request.setRequestHeader("Cache-Control", "no-cache");
xml_request.send(null);
return xml_request;
};

function xml_loaded (event, request, callback) {
if (request.responseXML)
{
var obj = {error:false, errorString:null};
var effectiveRoot = findChild(findChild(request.responseXML, "rss"), "channel");
obj.realFeel = findChild(effectiveRoot, "yweather:wind").getAttribute("chill");
conditionTag = findChild(findChild(effectiveRoot, "item"), "yweather:condition");
obj.temp = conditionTag.getAttribute("temp");
obj.icon = conditionTag.getAttribute("code");

obj.condition = conditionTag.getAttribute("text");



obj.city = findChild(effectiveRoot, "yweather:location").getAttribute("city");
obj.city = "桃園市";
obj.plus0low = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("low");
obj.plus1low = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("low");
obj.plus2low = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("low");
obj.plus3low = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("low");
obj.plus4low = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("low");

obj.plus0high = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("high");
obj.plus1high = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("high");
obj.plus2high = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("high");
obj.plus3high = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("high");
obj.plus4high = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("high");

obj.plus0day = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("day");
obj.plus1day = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("day");
obj.plus2day = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("day");
obj.plus3day = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("day");
obj.plus4day = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("day");

obj.plus0code = request.responseXML.getElementsByTagName("forecast")[0].getAttribute("code");
obj.plus1code = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("code");
obj.plus2code = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("code");
obj.plus3code = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("code");
obj.plus4code = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("code");

obj.plus1text = request.responseXML.getElementsByTagName("forecast")[1].getAttribute("text");
obj.plus2text = request.responseXML.getElementsByTagName("forecast")[2].getAttribute("text");
obj.plus3text = request.responseXML.getElementsByTagName("forecast")[3].getAttribute("text");
obj.plus4text = request.responseXML.getElementsByTagName("forecast")[4].getAttribute("text");


callback (obj);
}
else {
callback ({error:true, errorString:"XML request failed. no responseXML"});
}
};

function longform(day) {
if (day == "Mon") { return "星期一"};
if (day == "Tue") { return "星期二"};
if (day == "Wed") { return "星期三"};
if (day == "Thu") { return "星期四"};
if (day == "Fri") { return "星期五"};
if (day == "Sat") { return "星期六"};
if (day == "Sun") { return "星期日"};
}

function validateWeatherLocation (location, callback) {
var obj = {error:false, errorString:null, cities: new Array};
obj.cities[0] = {zip: location}; //Not very clever, are we?
callback (obj);

};

function convertTemp(num) {
if (isCelsius == true)
return Math.round (((num - 32) * 5) / 9);
else
return parseInt(num);
};

$(document).ready(function () {
enableWeather();
});

2013-04-16 0:59 發佈
看了你的程式碼
應該是 document.getElementById("condition")[removed] = obj.condition;
這一段在顯示 實際你比對一下你的 html檔

如果是這個
在他前面
加上那48個天氣條件的翻譯吧
一個要一行哦

舉例:
if (obj.condition=='snow') { document.getElementById("condition")[removed]='下雪'; }
大大…依你的方式修改,還是顯示英文的。以下為LockBackground.html原始碼,可再麻煩幫我看一下嗎。

<!DOCTYPE html>

<head lang="en">

<title>peekly</title>

<meta charset="UTF-8" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'/>



<link rel="stylesheet" type="text/css" href="css/style.css">













</head>

<body>

<base href="Weather/"/>











  • a


  • c


  • d


  • e






















City







Condition

















<script>

var slider = new Swipe(document.getElementById('slider'));

// for browser testing

$("#slider").dblclick(function () {

$(this).hide();

});



$("body").keydown(function(e) {

if(e.keyCode == 37) { // left

slider.prev();

} else if(e.keyCode == 39) { // right

slider.next();

}

});

//

// Clocks

//

if (showTimeAndDate && clockType === "default") {

$('#timeAndDate').append('
 
 
 
');

} else if (showTimeAndDate && clockType === "digital"){

$('#timeAndDate').append('
 
 
 
');

} else if (showTimeAndDate && clockType === "analog"){

$('#timeAndDate').append('
');

} else if (showTimeAndDate && clockType === "words"){

$('#timeAndDate').append('

');

} else if (showTimeAndDate && clockType === "helvetica"){

$('#timeAndDate').append('

');

}else {

$('#timeAndDate').append('
');

};

//

// Peek call

//

if (gMailAddress) {

$.getScript("../js/upcoming-0.6.0.min.js").done(function() {

var googleCalendar = "https://www.google.com/calendar/feeds/" + gMailAddress + "/public/full";

$('#peekLeft').append('
');

upcomingjs.load(googleCalendar);

})

.fail(function() {

$('#peekLeft').append(' Error Loading Google Calendar javascript ');

});

} else if (twitterAccount) {

$.getScript("../js/twitter.js").done(function() {

$('#peekLeft').append('
  ');

})

.fail(function() {

$('#peekLeft').append(' Error Loading Twitter javascript ');

});

} else if (RSSfeed) {

$.getScript("../js/FeedEk.js").done(function() {

$('#peekLeft').append('
');

$('#divRss').FeedEk({

FeedUrl : RSSfeed,

MaxCount : numberOfItems,

ShowDesc : true,

ShowPubDate: true

});

})

.fail(function() {

$('#peekLeft').append(' Error Loading RSS javascript ');

});

} else {

$.getScript("../js/basiccalendar.js").done(function() {

var todaydate=new Date();

var curmonth=todaydate.getMonth()+1;

var curyear=todaydate.getFullYear();

$('#peekLeft').append('
');

document.getElementById("previousMonth")[removed] = (buildCal(curmonth-1 ,curyear, "main", "month", "daysofweek", "days", 1));

document.getElementById("currentMonth")[removed] = (buildCal(curmonth ,curyear, "main", "month", "daysofweek", "days", 1));

document.getElementById("nextMonth")[removed] = (buildCal(curmonth+1 ,curyear, "main", "month", "daysofweek", "days", 1));

$('.days #today').parent().css('background-color', '#48ace8');

})

.fail(function(jqxhr, settings, exception) {

$('#peekLeft').append(' Error Loading default Calendar javascript ');

});

};

//

// time and date

//

// if (showTimeAndDate && clockType == "analog") {





// }

if (showTimeAndDate) {

function theTime (){



var currentTime = new Date();

var hour = currentTime.getHours();

var minute = currentTime.getMinutes();

var second = currentTime.getSeconds();



if (twelveHour) {

if ( hour > 11 ) {

hour -= 12;

}

}



if (clockType == "analog") {

// get the elements needed:

var analogmin = document.getElementById('analogmin');

var analoghour = document.getElementById('analoghour');



// declare some variables, we constantly use:

var tmpRotValue = "";

var curDate, curSec, curMin, curHour, secRot, minRot, hourRot;

function setRotation(elem, degrees) {

tmpRotValue = "rotate(" + degrees + "deg)";

elem.setAttribute(

"style",

"-webkit-transform:"+tmpRotValue+"; -moz-transform:"+tmpRotValue+"; -ms-transform:"+tmpRotValue+"; -o-transform:"+tmpRotValue+"; transform:"+tmpRotValue+";"

);

}

function tick() {



// get the current date and time:

// curDate = new Date();

// extract the values for sec, min and hour:

// curMin = curDate.getMinutes();

// curHour = curDate.getHours();

// make sure, the hour is in the range of [0..11] and not in [12..23]

if ( hour > 11 ) {

hour -= 12;

}

// calculate the rotations per hand:

minRot = minute * 6; // 360°/60min = 6° per minute

hourRot = hour * 30 + minute/2; // 360°/12hours = 30° per hour

// apply rotations:

setRotation(analogmin, minRot);

setRotation(analoghour, hourRot);

}

tick();

}





if (clockType == "words") {

if (twelveHour) {

var hours = ["ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "ELEVEN", "TWELVE"];

} else {

var hours = ["凌晨1點", "凌晨2點", "凌晨3點", "凌晨4點", "凌晨5點", "上午6點", "上午7點", "上午8點", "上午9點", "上午10點", "上午11點", "中午12點","下午1點","下午2點","下午3點","下午4點","下午5點","晩上6點","晩上7點","晩上8點","晩上9點","晩上10點","晩上11點","凌晨12點"];

}

var minutes = ["01分", "02分", "03分", "04分", "05分", "06分", "07分", "08分", "09分", "10分", "11分", "12分", "13分", "14分", "15分", "16分", "17分", "18分", "19分", "20分", "21分", "22分", "23分", "24分", "25分", "26分", "27分", "28分", "29分", "30分", "31分", "32分", "33分", "34分", "35分", "36分", "37分", "38分", "39分", "40分", "41分", "42分", "43分", "44分", "45分", "46分", "47分", "48分", "49分", "50分", "51分", "52分", "53分", "54分", "55分", "56分", "57分", "58分", "59分", "00分"];



if (minute == 15) {

document.getElementById("hour").innerText = "過了15分鐘";

document.getElementById("minute").innerText = hours[hour-1];

} else if (minute == 10) {

document.getElementById("hour").innerText = "過了10分鐘";

document.getElementById("minute").innerText = hours[hour-1];

} else if (minute == 30) {

document.getElementById("hour").innerText = "過了30分鐘";

document.getElementById("minute").innerText = hours[hour-1];

} else if (minute == 45) {

document.getElementById("hour").innerText = "15分鐘之後";

document.getElementById("minute").innerText = hours[hour];

} else if (minute == 50) {

document.getElementById("hour").innerText = "10分鐘之後";

document.getElementById("minute").innerText = hours[hour];

} else if (minute == 00) {

document.getElementById("hour").innerText = hours[hour-1];

document.getElementById("minute").innerText = "整點";

} else {

document.getElementById("hour").innerText = hours[hour-1];

document.getElementById("minute").innerText = minutes[minute-1];

}

}



if (clockType == "digital" || clockType == "default") {

document.getElementById('time')[removed] = '' + hour + ":" + minute + '';

document.getElementById("secondsProgress").style.width = (second / 60 * 100) + "%";

}





setTimeout('theTime()', 500);

}

function calculateDate() {

var months = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月 ","10月","11月","12月");

var weekdays = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];

var currentTime = new Date();

var day = currentTime.getDate().toString();

var month = currentTime.getMonth();

var weekday = currentTime.getDay();



var n = day.charAt(day.length - 1);



if (n == 1) {

if (day == 11) {

day+="日";

} else {

day+="日";

}

} else if (n == 2) {

if (day == 12) {

day+="日";

} else {

day+="日";

}

} else if (n == 3) {

if (day == 13) {

day+="日";

} else {

day+="日";

}

} else {

day+="日";

}



if (day.length == 1) { day1 = "0" + day; }



if (dateFormat == "DayDateMonth" && clockType != "analog") {

document.getElementById("date").innerText = weekdays[weekday] + ", " + day + " " + months[month];

} else if (dateFormat == "DayMonthDate" && clockType != "analog") {

document.getElementById("date").innerText = weekdays[weekday] + ", " + months[month] + " " + day;

} else {

return

}



}

setInterval(calculateDate, 60000);

theTime();

calculateDate();

}

</script>

</body>

</html>
他好像是有區分大小寫的
<yweather:condition text="Partly Cloudy"

試試字首都大寫看看囉

a995101 wrote:
如題各位大大,可否麻...(恕刪)


大概修改了一下,直接下載把原來weather.js檔替換掉!

下載weather.js

內文搜尋
X
評分
評分
複製連結
Mobile01提醒您
您目前瀏覽的是行動版網頁
是否切換到電腦版網頁呢?