mirror of
https://github.com/searxng/searxng.git
synced 2025-08-19 02:06:50 +02:00
[fix] translate engine errors to Occitan when configured
This commit is contained in:
parent
ba7c8d7b96
commit
bce3830b8d
3 changed files with 19 additions and 16 deletions
|
@ -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"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue