From 557145a5e9e773763560decd6e3102babbbbe109 Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Wed, 7 Oct 2026 12:56:34 +0200 Subject: [PATCH] Add Feuchte/Wind and 2-letter time labels with i18n --- i18n.js | 11 ++++++++++- index.html | 7 +++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/i18n.js b/i18n.js index d737b93..bce0d1c 100644 --- a/i18n.js +++ b/i18n.js @@ -36,7 +36,16 @@ window.TRANSLATIONS = { 'Do.': { de: 'Do.', en: 'Th.' }, 'Fr.': { de: 'Fr.', en: 'Fr.' }, 'Sa.': { de: 'Sa.', en: 'Sa.' }, - 'So.': { de: 'So.', en: 'Su.' } + 'So.': { de: 'So.', en: 'Su.' }, + + 'Feuchte': { de: 'Feuchte', en: 'Humidity' }, + 'Wind': { de: 'Wind', en: 'Wind' }, + + // 2-letter time-of-day labels (Morgen, Mittag, Abend, Nacht) + 'Morgen': { de: 'Mo', en: 'Mo' }, + 'Mittag': { de: 'Mi', en: 'Mi' }, + 'Abend': { de: 'Ab', en: 'Ab' }, + 'Nacht': { de: 'Na', en: 'Ni' } }; window.getTranslation = function(key) { diff --git a/index.html b/index.html index 15063bc..74a0da0 100644 --- a/index.html +++ b/index.html @@ -1287,6 +1287,9 @@ window.weatherThemes = { var key = els[i].getAttribute('data-i18n'); els[i].textContent = t(key); } + // Trigger a weather refresh so dynamic texts (slot labels, current + // weather details) are re-rendered with the new language. + if (typeof fetchWeather === 'function') fetchWeather(); } function setDebugLanguage(lang) { @@ -1587,7 +1590,7 @@ window.weatherThemes = { var currentHtml = '
' + weatherSVG(current.weather_code) + '
' + '
' + Math.round(current.temperature_2m) + '°C
' + '
' + - 'Feuchte ' + Math.round(current.relative_humidity_2m) + '% · Wind ' + Math.round(current.wind_speed_10m) + ' km/h
'; + t('Feuchte') + ' ' + Math.round(current.relative_humidity_2m) + '% · ' + t('Wind') + ' ' + Math.round(current.wind_speed_10m) + ' km/h'; document.getElementById('weather-current').innerHTML = currentHtml; // Forecast @@ -1616,7 +1619,7 @@ window.weatherThemes = { var slotIdx = findHourlyIndex(slotDate, hourly.time); var slotCode = hourly.weather_code[slotIdx]; var slotTemp = hourly.temperature_2m[slotIdx]; - var slotLabels = ['M', 'Mi', 'A', 'N']; + var slotLabels = [t('Morgen'), t('Mittag'), t('Abend'), t('Nacht')]; slotsHtml += '
' + '
' + weatherSVG(slotCode) + '
' + '
' + slotLabels[i] + '
' +