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
This commit is contained in:
Alexandre Flament 2022-06-29 20:56:16 +02:00 committed by Markus Heiser
parent da416511b5
commit 578b2a8183
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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