From 90b9d1af1e41c10ad12e9f7a9752d2a027458a2e Mon Sep 17 00:00:00 2001 From: Envision <9063072+elapsingdreams@user.noreply.gitee.com> Date: Mon, 12 Aug 2024 22:13:59 +0800 Subject: [PATCH] =?UTF-8?q?:globe=5Fwith=5Fmeridians:=20liteyuki=5Fweather?= =?UTF-8?q?=20i18n=20(=E8=99=BD=E7=84=B6=E4=BB=85=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=B8=89=E7=A7=8D=E8=AF=AD=E8=A8=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liteyuki_weather/qw_api.py | 31 ++++++++++++------- src/resources/liteyuki_weather/lang/en.lang | 11 ++++++- src/resources/liteyuki_weather/lang/ja.lang | 11 ++++++- .../liteyuki_weather/lang/zh-CN.lang | 11 ++++++- .../templates/js/weather_now.js | 18 +++++------ 5 files changed, 59 insertions(+), 23 deletions(-) diff --git a/src/nonebot_plugins/liteyuki_weather/qw_api.py b/src/nonebot_plugins/liteyuki_weather/qw_api.py index ab47fad6..22300edd 100644 --- a/src/nonebot_plugins/liteyuki_weather/qw_api.py +++ b/src/nonebot_plugins/liteyuki_weather/qw_api.py @@ -43,18 +43,27 @@ def get_local_data(ulang_code: str) -> dict: """ ulang = Language(ulang_code) return { - "monday" : ulang.get("weather.monday"), + "monday" : ulang.get("weather.monday"), "tuesday" : ulang.get("weather.tuesday"), - "wednesday": ulang.get("weather.wednesday"), - "thursday" : ulang.get("weather.thursday"), - "friday" : ulang.get("weather.friday"), - "saturday" : ulang.get("weather.saturday"), - "sunday" : ulang.get("weather.sunday"), - "today" : ulang.get("weather.today"), - "tomorrow" : ulang.get("weather.tomorrow"), - "day" : ulang.get("weather.day"), - "night" : ulang.get("weather.night"), - "no_aqi" : ulang.get("weather.no_aqi"), + "wednesday" : ulang.get("weather.wednesday"), + "thursday" : ulang.get("weather.thursday"), + "friday" : ulang.get("weather.friday"), + "saturday" : ulang.get("weather.saturday"), + "sunday" : ulang.get("weather.sunday"), + "today" : ulang.get("weather.today"), + "tomorrow" : ulang.get("weather.tomorrow"), + "day" : ulang.get("weather.day"), + "night" : ulang.get("weather.night"), + "no_aqi" : ulang.get("weather.no_aqi"), + "now-windVelocity" : ulang.get("weather.now-windVelocity"), + "now-humidity" : ulang.get("weather.now-humidity"), + "now-feelsLike" : ulang.get("weather.now-feelsLike"), + "now-precip" : ulang.get("weather.now-precip"), + "now-pressure" : ulang.get("weather.now-pressure"), + "now-vis" : ulang.get("weather.now-vis"), + "now-cloud" : ulang.get("weather.now-cloud"), + "astronomy-sunrise" : ulang.get("weather.astronomy-sunrise"), + "astronomy-sunset" : ulang.get("weather.astronomy-sunset"), } diff --git a/src/resources/liteyuki_weather/lang/en.lang b/src/resources/liteyuki_weather/lang/en.lang index d8642dfe..7d3d68a5 100644 --- a/src/resources/liteyuki_weather/lang/en.lang +++ b/src/resources/liteyuki_weather/lang/en.lang @@ -9,4 +9,13 @@ weather.day=Day weather.night=Night weather.today=Today weather.tomorrow=Tomorrow -weather.no_aqi=No AQI data \ No newline at end of file +weather.no_aqi=No AQI data +weather.now-windVelocity=WS +weather.now-humidity=RH +weather.now-feelsLike=FL +weather.now-precip=PPT +weather.now-pressure=MSLP +weather.now-vis=VIS +weather.now-cloud=CC +weather.astronomy-sunrise=SR +weather.astronomy-sunset=SS \ No newline at end of file diff --git a/src/resources/liteyuki_weather/lang/ja.lang b/src/resources/liteyuki_weather/lang/ja.lang index 5c39ab6a..2b221bec 100644 --- a/src/resources/liteyuki_weather/lang/ja.lang +++ b/src/resources/liteyuki_weather/lang/ja.lang @@ -9,4 +9,13 @@ weather.day=昼 weather.night=夜 weather.today=今日 weather.tomorrow=明日 -weather.no_aqi=空気質データなし \ No newline at end of file +weather.no_aqi=空気質データなし +weather.now-windVelocity=風速 +weather.now-humidity=湿度 +weather.now-feelsLike=体感温度 +weather.now-precip=降水量 +weather.now-pressure=気圧 +weather.now-vis=能視距離 +weather.now-cloud=雲量 +weather.astronomy-sunrise=日出 +weather.astronomy-sunset=日没 \ No newline at end of file diff --git a/src/resources/liteyuki_weather/lang/zh-CN.lang b/src/resources/liteyuki_weather/lang/zh-CN.lang index e4fb52e1..26931d65 100644 --- a/src/resources/liteyuki_weather/lang/zh-CN.lang +++ b/src/resources/liteyuki_weather/lang/zh-CN.lang @@ -9,4 +9,13 @@ weather.day=白天 weather.night=夜晚 weather.today=今天 weather.tomorrow=明天 -weather.no_aqi=暂无AQI数据 \ No newline at end of file +weather.no_aqi=暂无AQI数据 +weather.now-windVelocity=风矢 +weather.now-humidity=湿度 +weather.now-feelsLike=体感 +weather.now-precip=降水 +weather.now-pressure=气压 +weather.now-vis=能见 +weather.now-cloud=云量 +weather.astronomy-sunrise=日出 +weather.astronomy-sunset=日落 \ No newline at end of file diff --git a/src/resources/liteyuki_weather/templates/js/weather_now.js b/src/resources/liteyuki_weather/templates/js/weather_now.js index 3dc87a23..c2cb7973 100644 --- a/src/resources/liteyuki_weather/templates/js/weather_now.js +++ b/src/resources/liteyuki_weather/templates/js/weather_now.js @@ -71,15 +71,15 @@ for (let id in templates) { let subtemplates = { "now-windDirect": weatherNow["now"]["windDir"] + " " + weatherNow["now"]["wind360"] + "°", - "now-windVelocity": "风矢 " + weatherNow["now"]["windScale"] + "级 " + weatherNow["now"]["windSpeed"] + "km/h", - "now-humidity": "湿度 " + weatherNow["now"]["humidity"] + "%", - "now-feelsLike": "体感 " + weatherNow["now"]["feelsLike"] + "°C", - "now-precip": "降水 " + weatherNow["now"]["precip"] + "mm", - "now-pressure": "气压 " + weatherNow["now"]["pressure"] + "hPa", - "now-vis": "能见 " + weatherNow["now"]["vis"] + "km", - "now-cloud": "云量 " + (weatherNow["now"]["cloud"] == "" ? "无数据" : (weatherNow["now"]["cloud"] + "%")), - "astronomy-sunrise": "日出 " + get_time_hour(weatherAstronomy["sunrise"]), - "astronomy-sunset": "日落 " + get_time_hour(weatherAstronomy["sunset"]) + "now-windVelocity": localData["now-windVelocity"] + " " + weatherNow["now"]["windScale"] + "级 " + weatherNow["now"]["windSpeed"] + "km/h", + "now-humidity": localData["now-humidity"] + " " + weatherNow["now"]["humidity"] + "%", + "now-feelsLike": localData["now-feelsLike"] + " " + weatherNow["now"]["feelsLike"] + "°C", + "now-precip": localData["now-precip"] + " " + weatherNow["now"]["precip"] + "mm", + "now-pressure": localData["now-pressure"] + " " + weatherNow["now"]["pressure"] + "hPa", + "now-vis": localData["now-vis"] + " " + weatherNow["now"]["vis"] + "km", + "now-cloud": localData["now-cloud"] + " " + (weatherNow["now"]["cloud"] == "" ? "无数据" : (weatherNow["now"]["cloud"] + "%")), + "astronomy-sunrise": localData["astronomy-sunrise"] + " " + get_time_hour(weatherAstronomy["sunrise"]), + "astronomy-sunset": localData["astronomy-sunset"] + " " + get_time_hour(weatherAstronomy["sunset"]) } let subiconMap = {