mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-22 16:01:01 +00:00
unescape html entity codes (ex: &apos)
This commit is contained in:
parent
9e77f82470
commit
79e5b0fb50
1 changed files with 3 additions and 2 deletions
|
@ -11,6 +11,7 @@ from flask_swagger import swagger
|
||||||
from flask_swagger_ui import get_swaggerui_blueprint
|
from flask_swagger_ui import get_swaggerui_blueprint
|
||||||
from translatehtml import translate_html
|
from translatehtml import translate_html
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
from html import unescape
|
||||||
|
|
||||||
from app import flood, remove_translated_files, security
|
from app import flood, remove_translated_files, security
|
||||||
from app.language import detect_languages, transliterate
|
from app.language import detect_languages, transliterate
|
||||||
|
@ -468,7 +469,7 @@ def create_app(args):
|
||||||
else:
|
else:
|
||||||
translated_text = translator.translate(transliterate(text, target_lang=source_langs[idx]))
|
translated_text = translator.translate(transliterate(text, target_lang=source_langs[idx]))
|
||||||
|
|
||||||
results.append(translated_text)
|
results.append(unescape(translated_text))
|
||||||
return jsonify(
|
return jsonify(
|
||||||
{
|
{
|
||||||
"translatedText": results
|
"translatedText": results
|
||||||
|
@ -483,7 +484,7 @@ def create_app(args):
|
||||||
translated_text = translator.translate(transliterate(q, target_lang=source_langs[0]))
|
translated_text = translator.translate(transliterate(q, target_lang=source_langs[0]))
|
||||||
return jsonify(
|
return jsonify(
|
||||||
{
|
{
|
||||||
"translatedText": translated_text
|
"translatedText": unescape(translated_text)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in a new issue