Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ The card automatically changes background and animations based on time of day:
- German
- French
- Dutch
- Spanish

## Development

Expand Down
2 changes: 1 addition & 1 deletion README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type: custom:dynamic-weather-card
entity: weather.home
name: Моя погода
height: 250
language: auto # 'auto' (по умолчанию), 'ru' или 'en'
language: auto # 'auto' (по умолчанию), 'ru', 'es' или 'en'
overlay_opacity: 0.2 # Прозрачность затемнения (0-1, по умолчанию: 0.1)
wind_speed_unit: ms # 'ms' (м/с, по умолчанию) или 'kmh' (км/ч)
show_feels_like: true
Expand Down
2 changes: 1 addition & 1 deletion info.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The card will automatically detect the language from Home Assistant settings.
type: custom:dynamic-weather-card
entity: weather.home
name: My Weather
language: auto # 'auto', 'ru' or 'en'
language: auto # 'auto', 'ru', 'es' or 'en'
show_feels_like: true
show_min_temp: true
show_forecast: true
Expand Down
4 changes: 3 additions & 1 deletion src/internalization/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import de from './locales/de/translation.js';
import nl from './locales/nl/translation.js';
import fr from './locales/fr/translation.js';
import en from './locales/en/translation.js';
import es from './locales/es/translation.js';

const translations = {
en,
ru,
de,
nl,
fr
fr,
es
};

class I18n {
Expand Down
3 changes: 2 additions & 1 deletion src/internalization/locales/de/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export default {
'english': '🇺🇸 English',
'russian': '🇷🇺 Русский',
'german': '🇩🇪 Deutsch',
'dutch': '🇳🇱 Nederlands'
'dutch': '🇳🇱 Nederlands',
'spanish': '🇪🇸 Español'
}
}
};
3 changes: 2 additions & 1 deletion src/internalization/locales/en/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export default {
'russian': '🇷🇺 Русский',
'french': '🇫🇷 Français',
'german': '🇩🇪 Deutsch',
'dutch': '🇳🇱 Nederlands'
'dutch': '🇳🇱 Nederlands',
'spanish': '🇪🇸 Español'
}
}
};
94 changes: 94 additions & 0 deletions src/internalization/locales/es/translation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
export default {
'sunny': 'Soleado',
'clear': 'Despejado',
'overcast': 'Cubierto',
'cloudy': 'Nublado',
'partlycloudy': 'Parcialmente Nublado',
'rainy': 'Lluvioso',
'rain': 'Lluvia',
'snowy': 'Nevado',
'snow': 'Nieve',
'foggy': 'Nublado',
'fog': 'Niebla',
'lightning': 'Rayo',
'lightning-rainy': 'Tormenta Eléctrica',
'pouring': 'Lluvia Intensa',
'snowy-rainy': 'Aguanieve',
'hail': 'Granizo',
'clear-night': 'Noche Despejada',
'feels_like': 'Sensación térmica',
'forecast_title': "Previsión para hoy",

Check failure on line 20 in src/internalization/locales/es/translation.js

View workflow job for this annotation

GitHub Actions / validate

Strings must use singlequote
'no_data': 'Sin datos',
'forecast_unavailable': 'Forecast unavailable',
'weather': 'Clima',
'language': 'Idioma',
'wind_unit_kmh': 'km/h',
'wind_unit_ms': 'm/s',
'demo': {
'pageTitle': '🌤️ Tarjeta Meteorológica Dinámica',
'pageSubtitle': 'Demostración interactiva Y Herramienta De Configuración',
'livePreview': 'Vista previa en vivo',
'configuration': '⚙️ Configuración',
'quickPresets': '🎨 Ajustes Rápidos',
'sunnyDay': 'Día soleado',
'rainy': 'Lluvioso',
'snowy': 'Nevado',
'clearNight': 'Noche despejada',
'weatherCondition': '🌦️ Condiciones Meteorológicas',
'condition': 'Condición',
'temperature': 'Temperatura (°C)',
'humidity': 'Humedad (%)',
'windSpeed': 'Velocidad Del Viento',
'timeOfDay': '🕐 Hora del Día',
'timeMode': 'Modo Tiempo',
'autoTime': '🕐 Auto (Hora Actual)',
'manualControl': '⏱️ Manual Control',
'sunrise': '🌅 Amanecer',
'day': '☀️ Día',
'sunset': '🌇 Atardecer',
'night': '🌙 Noche',
'currentTime': 'Hora Actual',
'displayOptions': '👁️ Opciones de Visualización',
'cardName': 'Nombre de la tarjeta',
'height': 'Altura (px)',
'feelsLike': 'Sensación Térmica',
'minTemp': 'Temperatura Mínima',
'windDirection': 'Dirección del Viento',
'windGust': 'Ráfaga de Viento',
'hourlyForecast': 'Previsión por Horas',
'sunriseSunset': 'Amanecer/Atardecer',
'updateCard': '🔄 Actualizar Tarjeta',
'startDemo': '🎬 Iniciar Modo Demostración',
'stopDemo': '⏹️ Detener Demostración',
'madeWith': 'Hecho con ❤️ para Home Assistant',
'loading': '⏳ Cargando tarjeta...',
'errorTitle': '⚠️ No se pudo cargar la tarjeta',
'errorDetails': 'Consulte la consola del navegador (F12) para obtener más detalles',
'errorServer': 'Asegúrate de que el archivo se sirve a través de un servidor local (not file://)',
'placeholderEmpty': 'Deje vacío para ocultar',
'weatherConditions': {
'sunny': '☀️ Soleado',
'clear': '☀️ Despejado',
'clearNight': '🌙 Noche Despejada',
'partlyCloudy': '⛅ Parcialmente Nublado',
'cloudy': '☁️ Nublado',
'rainy': '🌧️ Lluvioso',
'pouring': '⛈️ Torrencial',
'snowy': '❄️ Nevado',
'sleet': '🌨️ Aguanieve',
'hail': '🧊 Granizo',
'foggy': '🌫️ Nublado',
'lightning': '⚡ Rayos',
'thunderstorm': '⛈️ Tormenta Eléctrica'
},
'language': {
'title': '🌍 Idioma',
'english': '🇺🇸 English',
'russian': '🇷🇺 Русский',
'french': '🇫🇷 Français',
'german': '🇩🇪 Deutsch',
'dutch': '🇳🇱 Nederlands',
'spanish': '🇪🇸 Español'
}
}
};
3 changes: 2 additions & 1 deletion src/internalization/locales/fr/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export default {
'russian': '🇷🇺 Русский',
'french': '🇫🇷 Français',
'german': '🇩🇪 Deutsch',
'dutch': '🇳🇱 Nederlands'
'dutch': '🇳🇱 Nederlands',
'spanish': '🇪🇸 Español'
}
}
};
3 changes: 2 additions & 1 deletion src/internalization/locales/nl/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export default {
'english': '🇺🇸 English',
'russian': '🇷🇺 Русский',
'german': '🇩🇪 Deutsch',
'dutch': '🇳🇱 Nederlands'
'dutch': '🇳🇱 Nederlands',
'spanish': '🇪🇸 Español'
}
}
};
3 changes: 2 additions & 1 deletion src/internalization/locales/ru/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export default {
'russian': '🇷🇺 Русский',
'french': '🇫🇷 Français',
'german': '🇩🇪 Deutsch',
'dutch': '🇳🇱 Nederlands'
'dutch': '🇳🇱 Nederlands',
'spanish': '🇪🇸 Español'
}
}
};
1 change: 1 addition & 0 deletions src/internalization/resolveLanguage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const resolveLanguage = ({ configLang, hassLang } = {}) => {
if (lang.startsWith('de')) return 'de';
if (lang.startsWith('nl')) return 'nl';
if (lang.startsWith('fr')) return 'fr';
if (lang.startsWith('es')) return 'es';
}

return 'en';
Expand Down
3 changes: 2 additions & 1 deletion test.html
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ <h2 class="panel-title" data-i18n="configuration">⚙️ Configuration</h2>
<option value="fr" data-i18n="language.french">🇫🇷 Français</option>
<option value="de" data-i18n="language.german">🇩🇪 Deutsch</option>
<option value="nl" data-i18n="language.dutch">🇳🇱 Nederlands</option>
<option value="es" data-i18n="language.spanish">🇪🇸 Español</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -672,7 +673,7 @@ <h2 class="panel-title" data-i18n="configuration">⚙️ Configuration</h2>
<script type="module">
// Detect browser language early
let currentLang = (navigator.language || navigator.userLanguage || 'en').toLowerCase();
currentLang = currentLang.startsWith('ru') ? 'ru' : 'en';
currentLang = currentLang.startsWith('ru') ? 'ru' : currentLang.startsWith('es') ? 'es' : 'en';

// Mini translations for error messages
const errorMessages = {
Expand Down
Loading