From e1ea0bdb7ea44d09bb634824517a7aad3dd3e7a7 Mon Sep 17 00:00:00 2001 From: Ulas Kalayci Date: Wed, 22 Apr 2026 07:39:13 +0200 Subject: [PATCH] fix(weather): show correct wind speed and unit for imperial units MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When OPENWEATHER_UNITS=imperial, OpenWeatherMap returns wind speed in mph directly — the server was incorrectly multiplying by 3.6 (m/s→km/h) on top of that. All locale strings also hardcoded the unit label instead of using a {{windUnit}} placeholder, so the label always read km/h. Resolves #79 Co-Authored-By: Claude Sonnet 4.6 --- public/locales/ar.json | 2 +- public/locales/de.json | 2 +- public/locales/el.json | 2 +- public/locales/en.json | 2 +- public/locales/es.json | 2 +- public/locales/fr.json | 2 +- public/locales/hi.json | 2 +- public/locales/it.json | 2 +- public/locales/ja.json | 2 +- public/locales/pt.json | 2 +- public/locales/ru.json | 2 +- public/locales/sv.json | 2 +- public/locales/tr.json | 2 +- public/locales/uk.json | 2 +- public/locales/zh.json | 2 +- public/pages/dashboard.js | 3 ++- server/routes/weather.js | 5 ++++- 17 files changed, 21 insertions(+), 17 deletions(-) diff --git a/public/locales/ar.json b/public/locales/ar.json index e2a4ca7..3ce13ba 100644 --- a/public/locales/ar.json +++ b/public/locales/ar.json @@ -65,7 +65,7 @@ "weatherRefresh": "تحديث الطقس", "weatherRefreshTitle": "تحديث", "weatherUpdated": "تم تحديث الطقس", - "weatherFeelsLike": "الإحساس {{temp}}° · {{humidity}}% · الريح {{wind}} كم/س", + "weatherFeelsLike": "الإحساس {{temp}}° · {{humidity}}% · الريح {{wind}} {{windUnit}}", "fabTaskLabel": "إضافة مهمة", "fabCalendarLabel": "إضافة حدث", "fabShoppingLabel": "إضافة تسوق", diff --git a/public/locales/de.json b/public/locales/de.json index b655e1c..d78d2a9 100644 --- a/public/locales/de.json +++ b/public/locales/de.json @@ -72,7 +72,7 @@ "weatherRefresh": "Wetter aktualisieren", "weatherRefreshTitle": "Aktualisieren", "weatherUpdated": "Wetter aktualisiert", - "weatherFeelsLike": "Gefühlt {{temp}}° · {{humidity}}% · Wind {{wind}} km/h", + "weatherFeelsLike": "Gefühlt {{temp}}° · {{humidity}}% · Wind {{wind}} {{windUnit}}", "fabTaskLabel": "Aufgabe hinzufügen", "fabCalendarLabel": "Termin hinzufügen", "fabShoppingLabel": "Einkauf hinzufügen", diff --git a/public/locales/el.json b/public/locales/el.json index c6001d9..70b346c 100644 --- a/public/locales/el.json +++ b/public/locales/el.json @@ -65,7 +65,7 @@ "weatherRefresh": "Ανανέωση καιρού", "weatherRefreshTitle": "Ανανέωση", "weatherUpdated": "Καιρός ενημερώθηκε", - "weatherFeelsLike": "Αίσθηση {{temp}}° · {{humidity}}% · Άνεμος {{wind}} χλμ/ώ", + "weatherFeelsLike": "Αίσθηση {{temp}}° · {{humidity}}% · Άνεμος {{wind}} {{windUnit}}", "fabTaskLabel": "Προσθήκη εργασίας", "fabCalendarLabel": "Προσθήκη εκδήλωσης", "fabShoppingLabel": "Προσθήκη αγοράς", diff --git a/public/locales/en.json b/public/locales/en.json index ae547a5..5a3a170 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -65,7 +65,7 @@ "weatherRefresh": "Refresh weather", "weatherRefreshTitle": "Refresh", "weatherUpdated": "Weather updated", - "weatherFeelsLike": "Feels like {{temp}}° · {{humidity}}% · Wind {{wind}} km/h", + "weatherFeelsLike": "Feels like {{temp}}° · {{humidity}}% · Wind {{wind}} {{windUnit}}", "fabTaskLabel": "Add task", "fabCalendarLabel": "Add event", "fabShoppingLabel": "Add shopping", diff --git a/public/locales/es.json b/public/locales/es.json index b91dea7..8fd92bd 100644 --- a/public/locales/es.json +++ b/public/locales/es.json @@ -65,7 +65,7 @@ "weatherRefresh": "Actualizar tiempo", "weatherRefreshTitle": "Actualizar", "weatherUpdated": "Tiempo actualizado", - "weatherFeelsLike": "Sensación {{temp}}° · {{humidity}}% · Viento {{wind}} km/h", + "weatherFeelsLike": "Sensación {{temp}}° · {{humidity}}% · Viento {{wind}} {{windUnit}}", "fabTaskLabel": "Añadir tarea", "fabCalendarLabel": "Añadir evento", "fabShoppingLabel": "Añadir compra", diff --git a/public/locales/fr.json b/public/locales/fr.json index a678cdb..fe682a9 100644 --- a/public/locales/fr.json +++ b/public/locales/fr.json @@ -65,7 +65,7 @@ "weatherRefresh": "Actualiser la météo", "weatherRefreshTitle": "Actualiser", "weatherUpdated": "Météo mise à jour", - "weatherFeelsLike": "Ressenti {{temp}}° · {{humidity}}% · Vent {{wind}} km/h", + "weatherFeelsLike": "Ressenti {{temp}}° · {{humidity}}% · Vent {{wind}} {{windUnit}}", "fabTaskLabel": "Ajouter une tâche", "fabCalendarLabel": "Ajouter un événement", "fabShoppingLabel": "Ajouter une course", diff --git a/public/locales/hi.json b/public/locales/hi.json index 84ff196..2b26f77 100644 --- a/public/locales/hi.json +++ b/public/locales/hi.json @@ -65,7 +65,7 @@ "weatherRefresh": "मौसम अपडेट करें", "weatherRefreshTitle": "अपडेट", "weatherUpdated": "मौसम अपडेट हो गया", - "weatherFeelsLike": "महसूस होता है {{temp}}° · {{humidity}}% · हवा {{wind}} km/h", + "weatherFeelsLike": "महसूस होता है {{temp}}° · {{humidity}}% · हवा {{wind}} {{windUnit}}", "fabTaskLabel": "कार्य जोड़ें", "fabCalendarLabel": "कार्यक्रम जोड़ें", "fabShoppingLabel": "खरीदारी जोड़ें", diff --git a/public/locales/it.json b/public/locales/it.json index ecfcb6e..76c4167 100644 --- a/public/locales/it.json +++ b/public/locales/it.json @@ -65,7 +65,7 @@ "weatherRefresh": "Aggiorna meteo", "weatherRefreshTitle": "Aggiorna", "weatherUpdated": "Meteo aggiornato", - "weatherFeelsLike": "Percepiti {{temp}}° · {{humidity}}% · Vento {{wind}} km/h", + "weatherFeelsLike": "Percepiti {{temp}}° · {{humidity}}% · Vento {{wind}} {{windUnit}}", "fabTaskLabel": "Aggiungi compito", "fabCalendarLabel": "Aggiungi evento", "fabShoppingLabel": "Aggiungi spesa", diff --git a/public/locales/ja.json b/public/locales/ja.json index 7b4f3c3..7bd32ff 100644 --- a/public/locales/ja.json +++ b/public/locales/ja.json @@ -65,7 +65,7 @@ "weatherRefresh": "天気を更新", "weatherRefreshTitle": "更新", "weatherUpdated": "天気を更新しました", - "weatherFeelsLike": "体感 {{temp}}° · {{humidity}}% · 風速 {{wind}} km/h", + "weatherFeelsLike": "体感 {{temp}}° · {{humidity}}% · 風速 {{wind}} {{windUnit}}", "fabTaskLabel": "タスクを追加", "fabCalendarLabel": "予定を追加", "fabShoppingLabel": "買い物を追加", diff --git a/public/locales/pt.json b/public/locales/pt.json index cbcbab7..ff8ac43 100644 --- a/public/locales/pt.json +++ b/public/locales/pt.json @@ -65,7 +65,7 @@ "weatherRefresh": "Atualizar clima", "weatherRefreshTitle": "Atualizar", "weatherUpdated": "Clima atualizado", - "weatherFeelsLike": "Sensação {{temp}}° · {{humidity}}% · Vento {{wind}} km/h", + "weatherFeelsLike": "Sensação {{temp}}° · {{humidity}}% · Vento {{wind}} {{windUnit}}", "fabTaskLabel": "Adicionar tarefa", "fabCalendarLabel": "Adicionar evento", "fabShoppingLabel": "Adicionar compra", diff --git a/public/locales/ru.json b/public/locales/ru.json index 18fdfae..dc78b84 100644 --- a/public/locales/ru.json +++ b/public/locales/ru.json @@ -65,7 +65,7 @@ "weatherRefresh": "Обновить погоду", "weatherRefreshTitle": "Обновить", "weatherUpdated": "Погода обновлена", - "weatherFeelsLike": "Ощущается как {{temp}}° · {{humidity}}% · Ветер {{wind}} км/ч", + "weatherFeelsLike": "Ощущается как {{temp}}° · {{humidity}}% · Ветер {{wind}} {{windUnit}}", "fabTaskLabel": "Добавить задачу", "fabCalendarLabel": "Добавить событие", "fabShoppingLabel": "Добавить покупку", diff --git a/public/locales/sv.json b/public/locales/sv.json index b97b555..a88a67a 100644 --- a/public/locales/sv.json +++ b/public/locales/sv.json @@ -65,7 +65,7 @@ "weatherRefresh": "Uppdatera vädret", "weatherRefreshTitle": "Uppdatera", "weatherUpdated": "Väder uppdaterat", - "weatherFeelsLike": "Känns som {{temp}}° · {{humidity}}% · Vind {{wind}} km/h", + "weatherFeelsLike": "Känns som {{temp}}° · {{humidity}}% · Vind {{wind}} {{windUnit}}", "fabTaskLabel": "Lägg till uppgift", "fabCalendarLabel": "Lägg till händelse", "fabShoppingLabel": "Lägg till shopping", diff --git a/public/locales/tr.json b/public/locales/tr.json index e7e7836..d302b68 100644 --- a/public/locales/tr.json +++ b/public/locales/tr.json @@ -65,7 +65,7 @@ "weatherRefresh": "Hava durumunu yenile", "weatherRefreshTitle": "Yenile", "weatherUpdated": "Hava durumu güncellendi", - "weatherFeelsLike": "Hissedilen {{temp}}° · {{humidity}}% · Rüzgar {{wind}} km/s", + "weatherFeelsLike": "Hissedilen {{temp}}° · {{humidity}}% · Rüzgar {{wind}} {{windUnit}}", "fabTaskLabel": "Görev ekle", "fabCalendarLabel": "Etkinlik ekle", "fabShoppingLabel": "Alışveriş ekle", diff --git a/public/locales/uk.json b/public/locales/uk.json index d8cf773..9ca2dfc 100644 --- a/public/locales/uk.json +++ b/public/locales/uk.json @@ -65,7 +65,7 @@ "weatherRefresh": "Оновити погоду", "weatherRefreshTitle": "Оновити", "weatherUpdated": "Погоду оновлено", - "weatherFeelsLike": "Відчувається як {{temp}}° · {{humidity}}% · Вітер {{wind}} км/год", + "weatherFeelsLike": "Відчувається як {{temp}}° · {{humidity}}% · Вітер {{wind}} {{windUnit}}", "fabTaskLabel": "Додати завдання", "fabCalendarLabel": "Додати подію", "fabShoppingLabel": "Додати покупку", diff --git a/public/locales/zh.json b/public/locales/zh.json index 607136c..ea99e82 100644 --- a/public/locales/zh.json +++ b/public/locales/zh.json @@ -65,7 +65,7 @@ "weatherRefresh": "刷新天气", "weatherRefreshTitle": "刷新", "weatherUpdated": "天气已更新", - "weatherFeelsLike": "体感 {{temp}}° · {{humidity}}% · 风速 {{wind}} km/h", + "weatherFeelsLike": "体感 {{temp}}° · {{humidity}}% · 风速 {{wind}} {{windUnit}}", "fabTaskLabel": "添加任务", "fabCalendarLabel": "添加日程", "fabShoppingLabel": "添加购物", diff --git a/public/pages/dashboard.js b/public/pages/dashboard.js index f8f9415..ade8d1f 100644 --- a/public/pages/dashboard.js +++ b/public/pages/dashboard.js @@ -390,6 +390,7 @@ function renderWeatherWidget(weather) { const { city, current, forecast, units } = weather; const unitSymbol = units === 'imperial' ? '°F' : units === 'standard' ? 'K' : '°C'; + const windUnit = units === 'imperial' ? 'mph' : 'km/h'; const forecastHtml = forecast.map((d, i) => { const date = new Date(d.date + 'T12:00:00'); @@ -419,7 +420,7 @@ function renderWeatherWidget(weather) {
${esc(current.desc)}
${esc(city)}
- ${t('dashboard.weatherFeelsLike', { temp: current.feels_like, humidity: current.humidity, wind: current.wind_speed })} + ${t('dashboard.weatherFeelsLike', { temp: current.feels_like, humidity: current.humidity, wind: current.wind_speed, windUnit })}
{ humidity: currentJson.main.humidity, icon: currentJson.weather[0]?.icon, desc: currentJson.weather[0]?.description, - wind_speed: Math.round((currentJson.wind?.speed ?? 0) * 3.6), // m/s → km/h + // metric/standard: m/s → km/h; imperial: already mph + wind_speed: units === 'imperial' + ? Math.round(currentJson.wind?.speed ?? 0) + : Math.round((currentJson.wind?.speed ?? 0) * 3.6), }, forecast: forecastDays, };