From 578b2a81837b54444d91669803c3cc92838fc454 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Wed, 29 Jun 2022 20:56:16 +0200 Subject: [PATCH] fix searxng_extra/update/update*.py scripts call searx.locales.locales_initialize before using LOCALE_NAMES Related to https://github.com/searxng/searxng/pull/1306 --- searxng_extra/update/update_currencies.py | 3 ++- searxng_extra/update/update_engine_descriptions.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/searxng_extra/update/update_currencies.py b/searxng_extra/update/update_currencies.py index e51692e72..41ee2fa0b 100755 --- a/searxng_extra/update/update_currencies.py +++ b/searxng_extra/update/update_currencies.py @@ -19,10 +19,11 @@ import json from os.path import join from searx import searx_dir -from searx.locales import LOCALE_NAMES +from searx.locales import LOCALE_NAMES, locales_initialize from searx.engines import wikidata, set_loggers set_loggers(wikidata, 'wikidata') +locales_initialize() # ORDER BY (with all the query fields) is important to keep a deterministic result order # so multiple invokation of this script doesn't change currencies.json diff --git a/searxng_extra/update/update_engine_descriptions.py b/searxng_extra/update/update_engine_descriptions.py index 5b73fd396..f3d6e7fa8 100755 --- a/searxng_extra/update/update_engine_descriptions.py +++ b/searxng_extra/update/update_engine_descriptions.py @@ -22,13 +22,14 @@ from langdetect.lang_detect_exception import LangDetectException from searx.engines import wikidata, set_loggers from searx.utils import extract_text, match_language -from searx.locales import LOCALE_NAMES +from searx.locales import LOCALE_NAMES, locales_initialize from searx import searx_dir from searx.utils import gen_useragent import searx.search import searx.network set_loggers(wikidata, 'wikidata') +locales_initialize() SPARQL_WIKIPEDIA_ARTICLE = """ SELECT DISTINCT ?item ?name