如何在Android中的OpenWeatherMap api中更改描述语言

时间:2018-03-29 11:44:00

标签: java android retrofit2 openweathermap

在我的应用程序中,我想使用 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 帮助中说明如果将此代码添加到网址 lang=Farsi-fa,请更改此行"description": "few clouds" 语言。< / p>

我添加语言代码但不更改描述语言!

我该怎么办?请帮帮我

1 个答案:

答案 0 :(得分:3)

应该只是语言代码:

lang=fa

http://api.openweathermap.org/data/2.5/forecast/daily?q=tehran,ir&cnt=16&units=metric&lang=fa&appid=1487dd8a93bfd85d278d9ayty875ghyy

"description":"بارش خفیف باران"