feat: translate all user-facing text to Swedish for consistency

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 19:51:49 +01:00
parent 2b7fc6b016
commit 1b1460fd45
2 changed files with 28 additions and 9 deletions

View File

@@ -5,6 +5,24 @@
*/
class WeatherManager {
static WEATHER_CONDITIONS_SV = {
'Clear': 'Klart',
'Clouds': 'Molnigt',
'Rain': 'Regn',
'Drizzle': 'Duggregn',
'Thunderstorm': 'Åska',
'Snow': 'Snö',
'Mist': 'Dimma',
'Fog': 'Dimma',
'Haze': 'Dis',
'Smoke': 'Rök',
'Dust': 'Damm',
'Sand': 'Sand',
'Ash': 'Aska',
'Squall': 'Byar',
'Tornado': 'Tornado'
};
constructor(options = {}) {
// Default options
// Get API key from options, window (injected by server from .env), or fallback
@@ -297,7 +315,7 @@ class WeatherManager {
const conditionElement = document.querySelector('#custom-weather .weather-icon div');
if (conditionElement) {
conditionElement.textContent = this.weatherData.condition;
conditionElement.textContent = WeatherManager.WEATHER_CONDITIONS_SV[this.weatherData.condition] || this.weatherData.condition;
}
const iconElement = document.querySelector('#custom-weather .weather-icon img');
@@ -364,7 +382,7 @@ class WeatherManager {
if (sunTimesElement && this.sunTimes) {
const sunriseTime = this.formatTime(this.sunTimes.today.sunrise);
const sunsetTime = this.formatTime(this.sunTimes.today.sunset);
sunTimesElement.textContent = `☀️ Sunrise: ${sunriseTime} | 🌙 Sunset: ${sunsetTime}`;
sunTimesElement.textContent = `☀️ Soluppgång: ${sunriseTime} | 🌙 Solnedgång: ${sunsetTime}`;
}
// Update daylight hours bar
@@ -399,7 +417,8 @@ class WeatherManager {
const strong = document.createElement('strong');
strong.textContent = `${this.weatherData.temperature}\u00B0C`;
tempSpan.appendChild(strong);
tempSpan.appendChild(document.createTextNode(` ${this.weatherData.condition || ''}`));
const conditionSv = WeatherManager.WEATHER_CONDITIONS_SV[this.weatherData.condition] || this.weatherData.condition;
tempSpan.appendChild(document.createTextNode(` ${conditionSv || ''}`));
bar.appendChild(tempSpan);
const sep1 = document.createElement('span');
@@ -415,7 +434,7 @@ class WeatherManager {
}
const sunriseSpan = document.createElement('span');
sunriseSpan.textContent = `\u2600\uFE0F Sunrise ${sunriseStr}`;
sunriseSpan.textContent = `☀️ Sol ↑ ${sunriseStr}`;
bar.appendChild(sunriseSpan);
const sep2 = document.createElement('span');
@@ -424,7 +443,7 @@ class WeatherManager {
bar.appendChild(sep2);
const sunsetSpan = document.createElement('span');
sunsetSpan.textContent = `\uD83C\uDF19 Sunset ${sunsetStr}`;
sunsetSpan.textContent = `🌙 Sol ↓ ${sunsetStr}`;
bar.appendChild(sunsetSpan);
}