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:
@@ -119,16 +119,16 @@ class DeparturesManager {
|
||||
if (diffMinutes <= 0) {
|
||||
return 'Nu';
|
||||
} else if (diffMinutes === 1) {
|
||||
return 'In 1 minute';
|
||||
return 'Om 1 minut';
|
||||
} else if (diffMinutes < 60) {
|
||||
return `In ${diffMinutes} minutes`;
|
||||
return `Om ${diffMinutes} minuter`;
|
||||
} else {
|
||||
const hours = Math.floor(diffMinutes / 60);
|
||||
const minutes = diffMinutes % 60;
|
||||
if (minutes === 0) {
|
||||
return `In ${hours} hour${hours > 1 ? 's' : ''}`;
|
||||
return `Om ${hours} timm${hours > 1 ? 'ar' : 'e'}`;
|
||||
} else {
|
||||
return `In ${hours} hour${hours > 1 ? 's' : ''} and ${minutes} minute${minutes > 1 ? 's' : ''}`;
|
||||
return `Om ${hours} timm${hours > 1 ? 'ar' : 'e'} och ${minutes} minut${minutes > 1 ? 'er' : ''}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user