Vista Weather Forecast-fixed the bug of not displaying Chinese weather forecasts

Source: Internet
Author: User

After hard work, we modified the weather. js file to get the weather forecast for China!
It has been said by a friend that weather forecasts cannot be used in China because of wlsrvc. when the DLL file detects that the region is set to China, it returns 1506, prompting "your current country or region does not support this service. "
In fact, if we enter the address directly in the browser, we can return the weather forecast in China, so we can bypass this DLL file and modify the script to directly obtain information.
We can use Microsoft. xmldom to obtain XML data on the Internet, parse the data into a class, and return it to the original script for display.
In order to reduce the workload, I try to reduce the original Code The modification only adds some new code and modifies a few necessary places. If the experiment is successful on my machine, x86 and x64 should be used in theory.
Since I have not studied JavaScript deeply, the Code may be quite redundant. You can modify the code as needed, but note: to modify the two scripts, you must first obtain the ownership of the two files, for more information, see other Article . In addition, you can also perform Chinese-based conversion to replace the strings with Chinese characters. However, you need to write a function to replace it in a week.
Usage:
Download the compressed package and decompress it
X: \ Program Files \ Windows Sidebar \ gadgets \ weather. Gadget \ ZH-CN \ JS
Overwrite the original one (backup is recommended first ). X is the system disk.
For font problems, modify
X: \ Program Files \ Windows Sidebar \ gadgets \ weather. Gadget \ ZH-CN \ CSS \ weather.css
Set 12 rows
Font-family: Ms yahei, simsun, verana, segoe UI;
Change ms in to Microsoft, Because ms is the incorrect syntax, which causes simsun after the font is displayed (wbpluto note ):
Font-family: Microsoft yahei, simsun, verana, segoe UI;
The font becomes, and the display problem is also solved.
In addition, please drag it out of the sidebar to display the weather forecast for three days!
Related download 1
How to display Chinese city names:
1. Use the JS file in the attachment below to replace the weather. JS File
2. Modify the weather. JS File
Function tochineselocation (location)
{
VaR retlocation = location;
Switch (location)
{
Case ("Tangshan, CHN"): // Add other cities according to the format. Note: The English addresses of Tangshan and CHN are case-sensitive, and the commas (,) must be lower-case, with spaces.
Retlocation = "China-Tangshan"; // Add your own city.
Break;
Case ("Beijing, CHN "):
Retlocation = "China-Beijing ";
Break;
// By zzxxqq
Default:
Break;
}
Return retlocation;
}
Since there are too many cities in China, if all of them are added, the workload is too heavy. Please add them by yourself !!
Related download 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.