diff --git a/searx/engines/mozhi.py b/searx/engines/mozhi.py index 3858ca4ef..63c90084e 100644 --- a/searx/engines/mozhi.py +++ b/searx/engines/mozhi.py @@ -4,6 +4,7 @@ import random import re from urllib.parse import urlencode +from flask_babel import gettext about = { "website": 'https://codeberg.org/aryak/mozhi', @@ -43,13 +44,18 @@ def response(resp): if translation['word_choices']: for word in translation['word_choices']: - infobox += f"
{word['word']}
" + infobox += f"
{word['word']}: {word['definition']}
" - for example in word['examples_target']: - infobox += f"
{re.sub(r'<|>', '', example)}
" + if word['examples_target']: + for example in word['examples_target']: + infobox += f"
{re.sub(r'<|>', '', example)}
" + infobox += f"
{re.sub(r'<|>', '', example)}
" infobox += "
" + if translation['source_synonyms']: + infobox += f"
{gettext('Synonyms')}: {', '.join(translation['source_synonyms'])}
" + result = { 'infobox': translation['translated-text'], 'content': infobox,