Restructure i18n.js: English is base, keys are English text

This commit is contained in:
Richard Zink committed 2026-10-07 13:02:29 +02:00
1 parent ecc3156652
commit 66ca03ade4
2 files changed
+47 -47

No files matched your search

+14 -14
View File
@@ -412,37 +412,37 @@
<div class="info-icon">
<svg viewBox="0 0 24 24" fill="var(--orange)"><circle cx="12" cy="12" r="4"/><g stroke="var(--orange)" stroke-width="2" stroke-linecap="round"><line x1="12" y1="2" x2="12" y2="5"/><line x1="12" y1="19" x2="12" y2="22"/><line x1="2" y1="12" x2="5" y2="12"/><line x1="19" y1="12" x2="22" y2="12"/><line x1="4.9" y1="4.9" x2="6.9" y2="6.9"/><line x1="17.1" y1="17.1" x2="19.1" y2="19.1"/><line x1="4.9" y1="19.1" x2="6.9" y2="17.1"/><line x1="17.1" y1="6.9" x2="19.1" y2="4.9"/></g></svg>
</div>
<div class="info-content"><span class="info-label" data-i18n="Aufgang">Aufgang</span><span><span class="info-value" id="sunrise-value">--:--</span><span class="info-sub" id="sunrise-when"></span></span></div>
<div class="info-content"><span class="info-label" data-i18n="Sunrise">Sunrise</span><span><span class="info-value" id="sunrise-value">--:--</span><span class="info-sub" id="sunrise-when"></span></span></div>
</div>
<div class="info-row">
<div class="info-icon">
<svg viewBox="0 0 24 24" fill="var(--orange)"><circle cx="12" cy="12" r="4"/><line x1="12" y1="12" x2="12" y2="3" stroke="var(--orange)" stroke-width="2"/></svg>
</div>
<div class="info-content"><span class="info-label" data-i18n="Zenit Sonne">Zenit Sonne</span><span><span class="info-value" id="sun-zenith-value">--:--</span><span class="info-sub" id="sun-zenith-when"></span></span></div>
<div class="info-content"><span class="info-label" data-i18n="Sun Zenith">Sun Zenith</span><span><span class="info-value" id="sun-zenith-value">--:--</span><span class="info-sub" id="sun-zenith-when"></span></span></div>
</div>
<div class="info-row">
<div class="info-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="var(--orange)" stroke-width="2"><path d="M3 12 A9 9 0 0 1 21 12 Z"/></svg>
</div>
<div class="info-content"><span class="info-label" data-i18n="Untergang">Untergang</span><span><span class="info-value" id="sunset-value">--:--</span><span class="info-sub" id="sunset-when"></span></span></div>
<div class="info-content"><span class="info-label" data-i18n="Sunset">Sunset</span><span><span class="info-value" id="sunset-value">--:--</span><span class="info-sub" id="sunset-when"></span></span></div>
</div>
<div class="info-row">
<div class="info-icon">
<svg id="moon-phase-icon" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="var(--dark)"/></svg>
</div>
<div class="info-content"><span class="info-label" data-i18n="Mondphase">Mondphase</span><span class="info-value" id="moon-phase-text">--</span></div>
<div class="info-content"><span class="info-label" data-i18n="Moon Phase">Moon Phase</span><span class="info-value" id="moon-phase-text">--</span></div>
</div>
<div class="info-row">
<div class="info-icon">
<svg viewBox="0 0 24 24" fill="var(--icon)"><path d="M12 2 a10 10 0 1 0 0 20 a8 8 0 1 1 0 -16 a6 6 0 1 1 0 8"/></svg>
</div>
<div class="info-content"><span class="info-label" data-i18n="Mond auf">Mond auf</span><span><span class="info-value" id="moonrise-value">--:--</span><span class="info-sub" id="moonrise-when"></span></span></div>
<div class="info-content"><span class="info-label" data-i18n="Moonrise">Moonrise</span><span><span class="info-value" id="moonrise-value">--:--</span><span class="info-sub" id="moonrise-when"></span></span></div>
</div>
<div class="info-row">
<div class="info-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="var(--icon)" stroke-width="2"><path d="M3 12 A9 9 0 0 1 21 22 Z"/></svg>
</div>
<div class="info-content"><span class="info-label" data-i18n="Mond unter">Mond unter</span><span><span class="info-value" id="moonset-value">--:--</span><span class="info-sub" id="moonset-when"></span></span></div>
<div class="info-content"><span class="info-label" data-i18n="Moonset">Moonset</span><span><span class="info-value" id="moonset-value">--:--</span><span class="info-sub" id="moonset-when"></span></span></div>
</div>
<div id="weather-divider" class="weather-divider"></div>
<div id="weather-current" class="weather-current"></div>
@@ -834,7 +834,7 @@ var effect = (VANTA.CLOUDS2 || VANTA.CLOUDS)({
var times = type.indexOf('moon') === 0 ? SunCalc.getMoonTimes(nextDate, lat, lon) : SunCalc.getTimes(nextDate, lat, lon);
var ev = type === 'moonrise' ? times.rise : type === 'moonset' ? times.set : times[type];
if (ev && !isNaN(ev.getTime())) {
var dayLabel = d === 1 ? t('morgen') : formatDateLong(nextDate);
var dayLabel = d === 1 ? t('tomorrow') : formatDateLong(nextDate);
return { date: ev, label: dayLabel };
}
}
@@ -843,8 +843,8 @@ var effect = (VANTA.CLOUDS2 || VANTA.CLOUDS)({
function getMoonPhaseText(phase) {
var p = phase;
var keys = ['Neumond', 'Zunehm. Sichel', 'Erstes Viertel', 'Zunehm. Gibbous',
'Vollmond', 'Abnehm. Gibbous', 'Letztes Viertel', 'Abnehm. Sichel'];
var keys = ['New Moon', 'Waxing Crescent', 'First Quarter', 'Waxing Gibbous',
'Full Moon', 'Waning Gibbous', 'Last Quarter', 'Waning Crescent'];
var idx;
if (p < 0.0625 || p >= 0.9375) idx = 0;
else if (p < 0.1875) idx = 1;
@@ -1042,7 +1042,7 @@ var effect = (VANTA.CLOUDS2 || VANTA.CLOUDS)({
// Sun zenith (solar noon) - find next occurrence
var sunZenith = sunTimes.solarNoon;
var sunZenithWhen = sunZenith > now ? t('heute') : t('morgen');
var sunZenithWhen = sunZenith > now ? t('today') : t('tomorrow');
if (sunZenith <= now) {
var tomorrow = new Date(now);
tomorrow.setDate(tomorrow.getDate() + 1);
@@ -1590,16 +1590,16 @@ window.weatherThemes = {
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 class="weather-current-detail">' +
t('Feuchte') + ' ' + Math.round(current.relative_humidity_2m) + '% · ' + t('Wind') + ' ' + Math.round(current.wind_speed_10m) + ' km/h</div></div>';
t('Humidity') + ' ' + Math.round(current.relative_humidity_2m) + '% · ' + t('Wind') + ' ' + Math.round(current.wind_speed_10m) + ' km/h</div></div>';
document.getElementById('weather-current').innerHTML = currentHtml;
// Forecast
var forecastHtml = '';
for (var d = 0; d < 4; d++) {
var dayDate = new Date(daily.time[d]);
var dayLabel = d === 0 ? t('heute') : t('morgen');
var dayLabel = d === 0 ? t('today') : t('tomorrow');
if (d > 1) {
var weekdayKey = ['So.', 'Mo.', 'Di.', 'Mi.', 'Do.', 'Fr.', 'Sa.'][dayDate.getDay()];
var weekdayKey = ['Su.', 'Mo.', 'Tu.', 'We.', 'Th.', 'Fr.', 'Sa.'][dayDate.getDay()];
dayLabel = t(weekdayKey) + ' ' +
(dayDate.getDate() < 10 ? '0' : '') + dayDate.getDate() + '.' +
(dayDate.getMonth() + 1 < 10 ? '0' : '') + (dayDate.getMonth() + 1) + '.';
@@ -1619,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 = [t('Morgen'), t('Mittag'), t('Abend'), t('Nacht')];
var slotLabels = [t('Morning'), t('Noon'), t('Evening'), t('Night')];
slotsHtml += '<div class="weather-slot">' +
'<div class="weather-slot-icon">' + weatherSVG(slotCode) + '</div>' +
'<div class="weather-slot-label">' + slotLabels[i] + '</div>' +