From 27369ebec23b39e9e61b175e6d23fdf2448da6b7 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 4 Apr 2023 15:17:12 +0200 Subject: [fix] searxng_extra/update/update_engine_descriptions.py (part 1) Follow up of #2269 The script to update the descriptions of the engines does no longer work since PR #2269 has been merged. searx/engines/wikipedia.py ========================== 1. There was a misusage of zh-classical.wikipedia.org: - `zh-classical` is dedicate to classical Chinese [1] which is not traditional Chinese [2]. - zh.wikipedia.org has LanguageConverter enabled [3] and is going to dynamically show simplified or traditional Chinese according to the HTTP Accept-Language header. 2. The update_engine_descriptions.py needs a list of all wikipedias. The implementation from #2269 included only a reduced list: - https://meta.wikimedia.org/wiki/Wikipedia_article_depth - https://meta.wikimedia.org/wiki/List_of_Wikipedias searxng_extra/update/update_engine_descriptions.py ================================================== Before PR #2269 there was a match_language() function that did an approximation using various methods. With PR #2269 there are only the types in the data model of the languages, which can be recognized by babel. The approximation methods, which are needed (only here) in the determination of the descriptions, must be replaced by other methods. [1] https://en.wikipedia.org/wiki/Classical_Chinese [2] https://en.wikipedia.org/wiki/Traditional_Chinese_characters [3] https://www.mediawiki.org/wiki/Writing_systems#LanguageConverter Closes: https://github.com/searxng/searxng/issues/2330 Signed-off-by: Markus Heiser --- searx/enginelib/traits.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'searx/enginelib') diff --git a/searx/enginelib/traits.py b/searx/enginelib/traits.py index df7851594..ae27d46f1 100644 --- a/searx/enginelib/traits.py +++ b/searx/enginelib/traits.py @@ -13,7 +13,7 @@ used. from __future__ import annotations import json import dataclasses -from typing import Dict, Union, Callable, Optional, TYPE_CHECKING +from typing import Dict, Iterable, Union, Callable, Optional, TYPE_CHECKING from typing_extensions import Literal, Self from searx import locales @@ -81,7 +81,7 @@ class EngineTraits: """Data type, default is 'traits_v1'. """ - custom: Dict[str, Dict] = dataclasses.field(default_factory=dict) + custom: Dict[str, Union[Dict[str, Dict], Iterable[str]]] = dataclasses.field(default_factory=dict) """A place to store engine's custom traits, not related to the SearXNG core """ -- cgit v1.2.3