mirror of
https://github.com/searxng/searxng.git
synced 2025-12-23 20:20:05 +00:00
[fix] translate engine errors to Occitan when configured
This commit is contained in:
@@ -626,7 +626,7 @@ def index():
|
||||
'corrections': list(result_container.corrections),
|
||||
'infoboxes': result_container.infoboxes,
|
||||
'suggestions': list(result_container.suggestions),
|
||||
'unresponsive_engines': list(result_container.unresponsive_engines)},
|
||||
'unresponsive_engines': __get_translated_errors(result_container.unresponsive_engines)}, # noqa
|
||||
default=lambda item: list(item) if isinstance(item, set) else item),
|
||||
mimetype='application/json')
|
||||
elif output_format == 'csv':
|
||||
@@ -694,7 +694,7 @@ def index():
|
||||
corrections=correction_urls,
|
||||
infoboxes=result_container.infoboxes,
|
||||
paging=result_container.paging,
|
||||
unresponsive_engines=result_container.unresponsive_engines,
|
||||
unresponsive_engines=__get_translated_errors(result_container.unresponsive_engines),
|
||||
current_language=match_language(search_query.lang,
|
||||
LANGUAGE_CODES,
|
||||
fallback=request.preferences.get_value("language")),
|
||||
@@ -705,6 +705,16 @@ def index():
|
||||
)
|
||||
|
||||
|
||||
def __get_translated_errors(unresponsive_engines):
|
||||
translated_errors = []
|
||||
for unresponsive_engine in unresponsive_engines:
|
||||
error_msg = gettext(unresponsive_engine[1])
|
||||
if unresponsive_engine[2]:
|
||||
error_msg = "{} {}".format(error_msg, unresponsive_engine[2])
|
||||
translated_errors.append((unresponsive_engine[0], error_msg))
|
||||
return translated_errors
|
||||
|
||||
|
||||
@app.route('/about', methods=['GET'])
|
||||
def about():
|
||||
"""Render about page"""
|
||||
|
||||
Reference in New Issue
Block a user