From ff206e967993bd2e7aa6597b03d0affee20948b9 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 29 May 2025 11:38:34 +0200 Subject: [mod] weather results: add types, i18n/l10n, symbols & unit conversions The types necessary for weather information such as GeoLocation, DateTime, Temperature,Pressure, WindSpeed, RelativeHumidity, Compass (wind direction) and symbols for the weather have been implemented. There are unit conversions and translations for weather property labels. Signed-off-by: Markus Heiser --- searx/templates/simple/answer/weather.html | 117 ++++++++++++++--------------- 1 file changed, 56 insertions(+), 61 deletions(-) (limited to 'searx/templates/simple/answer') diff --git a/searx/templates/simple/answer/weather.html b/searx/templates/simple/answer/weather.html index 4cea9b683..bd59d4cfe 100644 --- a/searx/templates/simple/answer/weather.html +++ b/searx/templates/simple/answer/weather.html @@ -1,67 +1,62 @@ -{% macro show_weather_data(data) %} - - - {%- if data.condition -%} - - - - - {%- endif -%} - {%- if data.temperature -%} - - - - - {%- endif -%} - {%- if data.feelsLike -%} - - - - - {%- endif -%} - {%- if data.wind -%} - - - - - {%- endif -%} - {%- if data.humidity -%} - - - - - {%- endif -%} - {%- if data.pressure -%} - - - - - {%- endif -%} - - {%- for name, value in data.attributes.items() -%} - - - - - {%- endfor -%} - -
{{ _("Condition") }}{{ data.condition }}
{{ _("Temperature") }}{{ data.temperature }}
{{ _("Feels Like") }}{{ data.feelsLike }}
{{ _("Wind") }}{{ data.wind }}
{{ _("Humidity") }}{{ data.humidity }}
{{ _("Pressure") }}{{ data.pressure }}
{{ name }}{{ value }}
+{% macro show_weather_data(answer, data) %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {%- if data.url %}{% endif -%} +
{{ _("Temperature") }}:{{ data.temperature.l10n(locale=data.location) }}{{ _("Feels Like") }}:{{ data.feels_like.l10n(locale=data.location) }}
{{ _("Wind") }}:{{ data.wind_from.l10n(locale=data.location) }}: {{ data.wind_speed.l10n(locale=data.location) }}{{ _("Pressure") }}:{{ data.pressure.l10n(locale=data.location) }}
{{_("Humidity")}}:{{ data.humidity.l10n(locale=data.location) }}
{% endmacro %} -
- It's currently {{ answer.current.condition }}, {{ answer.current.temperature }} in {{ answer.location }} -
-

{{ answer.location }}

-

{{ _("Current condition") }}

- {{ show_weather_data(answer.current) }} - +
+ +
{{ answer.current.summary }}
+ {{ show_weather_data(answer, answer.current) }} +
+
{%- if answer.forecasts -%} -
- {%- for forecast in answer.forecasts -%} -

{{ forecast.time }}

- {{ show_weather_data(forecast) }} - {%- endfor -%} -
+
+ {%- for forecast in answer.forecasts -%} +
{{ forecast.datetime.l10n(locale=answer.current.location,fmt="short") }} {{ forecast.summary }}
+ {{ show_weather_data(answer, forecast) }} + {%- endfor -%} +
{%- endif -%}
+ +{%- if answer.url -%} + + {{ answer.service }} + +{%- else -%} + {{ answer.service }} +{% endif -%} -- cgit v1.2.3