![](/img/trans.png)
[英]How to get the description string from the forecast weather array from the openweathermap API?
[英]How to change description language in OpenWeatherMap api in android
在我的应用程序中,我想使用OpenWeatherMap API 来显示城市的天气信息。
为此,我想将描述语言更改为Farsi 。
我在OpenWeatherMap的帮助下得到了这个,我在下面写了 URL :
http://api.openweathermap.org/data/2.5/forecast/daily?q=tehran,ir&cnt=16&units=metric&lang=Farsi-fa&appid=1487dd8a93bfd85d278d9ayty875ghyy
但给我看这个信息:
{
"city": {
"id": 112931,
"name": "Tehran",
"coord": {
"lon": 51.4014,
"lat": 35.7006
},
"country": "IR",
"population": 7153309
},
"cod": "200",
"message": 1.31599,
"cnt": 16,
"list": [
{
"dt": 1522310400,
"temp": {
"day": 29.68,
"min": 9.13,
"max": 29.68,
"night": 9.13,
"eve": 19.21,
"morn": 29.68
},
"pressure": 749.02,
"humidity": 67,
"weather": [
{
"id": 801,
"main": "Clouds",
"description": "few clouds",
"icon": "02d"
}
],
"speed": 1.42,
"deg": 211,
"clouds": 20
}
}
在OpenWeatherMap帮助中说如果将此代码添加到URL lang=Farsi-fa
更改此行"description": "few clouds"
语言。
我添加了语言代码但没有更改描述语言!
我该怎么做?
还有他们的 API 描述语言支持的语言列表吗?
它应该只是语言代码:
lang=fa
http://api.openweathermap.org/data/2.5/forecast/daily?q=tehran,ir&cnt=16&units=metric&lang=fa&appid=1487dd8a93bfd85d278d9ayty875ghyy
"description":"بارش خفیف باران"
多语言支持
您可以使用 lang 参数以您的语言获取 output。
翻译适用于城市名称和描述字段。
API 调用:
https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}&lang={lang}
它们支持以下语言,您可以使用相应的语言值:
af Afrikaans
al Albanian
ar Arabic
az Azerbaijani
bg Bulgarian
ca Catalan
cz Czech
da Danish
de German
el Greek
en English
eu Basque
fa Persian (Farsi)
fi Finnish
fr French
gl Galician
he Hebrew
hi Hindi
hr Croatian
hu Hungarian
id Indonesian
it Italian
ja Japanese
kr Korean
la Latvian
lt Lithuanian
mk Macedonian
no Norwegian
nl Dutch
pl Polish
pt Portuguese
pt_br Português Brasil
ro Romanian
ru Russian
sv, se Swedish
sk Slovak
sl Slovenian
sp, es Spanish
sr Serbian
th Thai
tr Turkish
ua, uk Ukrainian
vi Vietnamese
zh_cn Chinese Simplified
zh_tw Chinese Traditional
zu Zulu
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.