[mod] replace utils.match_language by locales.match_locale #186
+226
−130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch replaces the full of magic
utils.match_language
function by alocales.match_locale
. Thelocales.match_locale
function is based on thelocales.build_engine_locales
introduced in 9ae409a [1].In the past SearXNG did only support a search by a language but not in a region. This has been changed a long time ago and regions have been added to SearXNG core but not to the engines. The
utils.match_language
was the function to handle the different aspects of language/regions in SearXNG core and the supported languages in the engine. Theutils.match_language
did it with some magic and works good for most use cases but fails in some edge case.To replace the concurrence of languages and regions in the SearXNG core the
locales.build_engine_locales
was introduced in 9ae409a [1]. With the last patches all engines has been migrated to afetch_traits
and a language/region concept that is based onlocales.build_engine_locales
.To summarize: there is no longer a need for the
locales.match_language
.[1] searxng#1652