mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
[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 <markus.heiser@darmarit.de>
This commit is contained in:
committed by
Markus Heiser
parent
a800dd0473
commit
ff206e9679
@@ -45,6 +45,14 @@ def extract(
|
||||
namespace = {}
|
||||
exec(fileobj.read(), {}, namespace) # pylint: disable=exec-used
|
||||
|
||||
for name in namespace['__all__']:
|
||||
for k, v in namespace[name].items():
|
||||
yield 0, '_', v, ["%s['%s']" % (name, k)]
|
||||
for obj_name in namespace['__all__']:
|
||||
obj = namespace[obj_name]
|
||||
if isinstance(obj, list):
|
||||
for msg in obj:
|
||||
# (lineno, funcname, message, comments)
|
||||
yield 0, '_', msg, [f"{obj_name}"]
|
||||
elif isinstance(obj, dict):
|
||||
for k, msg in obj.items():
|
||||
yield 0, '_', msg, [f"{obj_name}['{k}']"]
|
||||
else:
|
||||
raise ValueError(f"{obj_name} should be list or dict")
|
||||
|
||||
Reference in New Issue
Block a user