feat(bot): translate all telegram bot messages to spanish

This commit is contained in:
dasemu committed 2026-03-13 06:27:17 +01:00
1 parent 1bc1e58781
commit b690e82f98
3 files changed
+48 -48

No files matched your search

+9 -9
View File
@@ -69,27 +69,27 @@ def _build_weather_summary(weather_data: dict[str, Any]) -> str:
temp_max = weather_data.get("temperature_2m_max")
temp_min = weather_data.get("temperature_2m_min")
if temp_max is not None and temp_min is not None:
parts.append(f"Temp {temp_min:.0f}–{temp_max:.0f} °C")
parts.append(f"Tª {temp_min:.0f}–{temp_max:.0f} °C")
elif temp_max is not None:
parts.append(f"Temp max {temp_max:.0f} °C")
parts.append(f"Tª máx {temp_max:.0f} °C")
snowfall = weather_data.get("snowfall_sum")
if snowfall is not None and snowfall > 0:
parts.append(f"Snow {snowfall:.0f} cm")
parts.append(f"Nieve {snowfall:.0f} cm")
snow_depth = weather_data.get("snow_depth")
if snow_depth is not None:
parts.append(f"Depth {snow_depth:.0f} cm")
parts.append(f"Espesor {snow_depth:.0f} cm")
precip = weather_data.get("precipitation_sum")
if precip is not None and precip > 0:
parts.append(f"Rain {precip:.1f} mm")
parts.append(f"Lluvia {precip:.1f} mm")
wind_gust = weather_data.get("wind_gusts_10m_max")
if wind_gust is not None:
parts.append(f"Gusts {wind_gust:.0f} km/h")
parts.append(f"Rachas {wind_gust:.0f} km/h")
return " | ".join(parts) if parts else "No weather data available."
return " | ".join(parts) if parts else "Sin datos meteorológicos disponibles."
class HybridPredictor:
@@ -413,9 +413,9 @@ class HybridPredictor:
reasons_text = " ".join(reasons).lower()
# Infer crowd from rule reasons text
if "high crowd" in reasons_text or "busy" in reasons_text:
if "afluencia alto" in reasons_text or "concurrida" in reasons_text:
return "high"
if "low crowd" in reasons_text:
if "afluencia bajo" in reasons_text:
return "low"
# Use ML prediction if available
+11 -11
View File
@@ -158,8 +158,8 @@ class RulesEngine:
if wind_gust >= wind_threshold:
force_closed = True
reasons.append(
f"Wind gust {wind_gust:.1f} km/h exceeds closure threshold "
f"of {wind_threshold} km/h."
f"Rachas de viento de {wind_gust:.1f} km/h superan el umbral de cierre de "
f"{wind_threshold} km/h."
)
logger.info(
"[%s] Rule 1 fired: wind gust %.1f > %.1f km/h -> force_closed",
@@ -177,8 +177,8 @@ class RulesEngine:
force_closed = True
km_factor = 0.0
reasons.append(
f"Snow depth {snow_depth:.1f} cm is below the minimum "
f"required {min_snow} cm."
f"El espesor de nieve ({snow_depth:.1f} cm) está por debajo del mínimo "
f"requerido ({min_snow} cm)."
)
logger.info(
"[%s] Rule 2 fired: snow depth %.1f < %.1f cm -> force_closed",
@@ -198,8 +198,8 @@ class RulesEngine:
):
km_factor = max(0.0, km_factor - _WARM_RAIN_KM_FACTOR_REDUCTION)
reasons.append(
f"Temperature {temp_max:.1f} °C above {_RAIN_TEMPERATURE_THRESHOLD_C} °C "
f"with {precip:.1f} mm precipitation; estimated open slopes reduced."
f"Temperatura de {temp_max:.1f} °C (superior a {_RAIN_TEMPERATURE_THRESHOLD_C} °C) "
f"con {precip:.1f} mm de precipitación; se estima una reducción de pistas abiertas."
)
logger.info(
"[%s] Rule 3 fired: temp %.1f °C + rain %.1f mm -> km_factor reduced to %.2f",
@@ -222,8 +222,8 @@ class RulesEngine:
):
force_open = True
reasons.append(
f"Heavy fresh snow ({snowfall_24h:.1f} cm in 24 h) with manageable "
f"wind ({wind_speed:.1f} km/h); station very likely open and busy."
f"Nevada intensa ({snowfall_24h:.1f} cm en 24 h) con viento moderado "
f"({wind_speed:.1f} km/h); es muy probable que la estación abra y esté concurrida."
)
logger.info(
"[%s] Rule 4 fired: heavy snow %.1f cm + wind %.1f km/h -> force_open",
@@ -240,15 +240,15 @@ class RulesEngine:
if not is_busy_day and no_fresh_snow and not force_closed:
reasons.append(
"Weekday with no significant fresh snow; crowd level expected to be low."
"Día laborable sin nevadas significativas; se espera un nivel de afluencia bajo."
)
logger.debug("[%s] Rule 5 fired: weekday + no fresh snow -> low crowd", station_name)
# ---- Rule 6: Weekend/holiday + fresh snow -> high crowd ----------
if is_busy_day and snowfall_24h is not None and snowfall_24h >= 5.0 and not force_closed:
reasons.append(
f"Weekend or holiday with {snowfall_24h:.1f} cm of fresh snow; "
"crowd level expected to be high."
f"Fin de semana o festivo con {snowfall_24h:.1f} cm de nieve fresca; "
"se espera un nivel de afluencia alto."
)
logger.debug(
"[%s] Rule 6 fired: busy day + fresh snow %.1f cm -> high crowd",