Add Feuchte/Wind and 2-letter time labels with i18n
This commit is contained in:
1 parent
1dc9b8a0ad
commit
557145a5e9
2 files changed
+15
-3
No files matched your search
@@ -36,7 +36,16 @@ window.TRANSLATIONS = {
|
|||||||
'Do.': { de: 'Do.', en: 'Th.' },
|
'Do.': { de: 'Do.', en: 'Th.' },
|
||||||
'Fr.': { de: 'Fr.', en: 'Fr.' },
|
'Fr.': { de: 'Fr.', en: 'Fr.' },
|
||||||
'Sa.': { de: 'Sa.', en: 'Sa.' },
|
'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) {
|
window.getTranslation = function(key) {
|
||||||
|
|||||||
+5
-2
@@ -1287,6 +1287,9 @@ window.weatherThemes = {
|
|||||||
var key = els[i].getAttribute('data-i18n');
|
var key = els[i].getAttribute('data-i18n');
|
||||||
els[i].textContent = t(key);
|
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) {
|
function setDebugLanguage(lang) {
|
||||||
@@ -1587,7 +1590,7 @@ window.weatherThemes = {
|
|||||||
var currentHtml = '<div class="weather-current-icon">' + weatherSVG(current.weather_code) + '</div>' +
|
var currentHtml = '<div class="weather-current-icon">' + weatherSVG(current.weather_code) + '</div>' +
|
||||||
'<div><div class="weather-current-temp">' + Math.round(current.temperature_2m) + '°C</div>' +
|
'<div><div class="weather-current-temp">' + Math.round(current.temperature_2m) + '°C</div>' +
|
||||||
'<div class="weather-current-detail">' +
|
'<div class="weather-current-detail">' +
|
||||||
'Feuchte ' + Math.round(current.relative_humidity_2m) + '% · Wind ' + Math.round(current.wind_speed_10m) + ' km/h</div></div>';
|
t('Feuchte') + ' ' + Math.round(current.relative_humidity_2m) + '% · ' + t('Wind') + ' ' + Math.round(current.wind_speed_10m) + ' km/h</div></div>';
|
||||||
document.getElementById('weather-current').innerHTML = currentHtml;
|
document.getElementById('weather-current').innerHTML = currentHtml;
|
||||||
|
|
||||||
// Forecast
|
// Forecast
|
||||||
@@ -1616,7 +1619,7 @@ window.weatherThemes = {
|
|||||||
var slotIdx = findHourlyIndex(slotDate, hourly.time);
|
var slotIdx = findHourlyIndex(slotDate, hourly.time);
|
||||||
var slotCode = hourly.weather_code[slotIdx];
|
var slotCode = hourly.weather_code[slotIdx];
|
||||||
var slotTemp = hourly.temperature_2m[slotIdx];
|
var slotTemp = hourly.temperature_2m[slotIdx];
|
||||||
var slotLabels = ['M', 'Mi', 'A', 'N'];
|
var slotLabels = [t('Morgen'), t('Mittag'), t('Abend'), t('Nacht')];
|
||||||
slotsHtml += '<div class="weather-slot">' +
|
slotsHtml += '<div class="weather-slot">' +
|
||||||
'<div class="weather-slot-icon">' + weatherSVG(slotCode) + '</div>' +
|
'<div class="weather-slot-icon">' + weatherSVG(slotCode) + '</div>' +
|
||||||
'<div class="weather-slot-label">' + slotLabels[i] + '</div>' +
|
'<div class="weather-slot-label">' + slotLabels[i] + '</div>' +
|
||||||
|
|||||||
Reference in new issue
Block a user