1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-12-24 10:06:43 +02:00

remove scheduler if files translation is disabled

This commit is contained in:
Sébastien Thuret 2021-10-25 17:12:09 +02:00
parent 909deccd3f
commit aac45a60ab
No known key found for this signature in database
GPG Key ID: 4742E2D66933BB08

View File

@ -13,8 +13,7 @@ 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 app import flood from app import flood, remove_translated_files
from app import remove_translated_files
from app.language import detect_languages, transliterate from app.language import detect_languages, transliterate
from .api_keys import Database from .api_keys import Database
from .suggestions import Database as SuggestionsDatabase from .suggestions import Database as SuggestionsDatabase
@ -29,9 +28,6 @@ def get_upload_dir():
return upload_dir return upload_dir
remove_translated_files.setup(get_upload_dir())
def get_json_dict(request): def get_json_dict(request):
d = request.get_json() d = request.get_json()
if not isinstance(d, dict): if not isinstance(d, dict):
@ -97,6 +93,9 @@ def create_app(args):
if args.debug: if args.debug:
app.config["TEMPLATES_AUTO_RELOAD"] = True app.config["TEMPLATES_AUTO_RELOAD"] = True
if not args.disable_files_translation:
remove_translated_files.setup(get_upload_dir())
# Map userdefined frontend languages to argos language object. # Map userdefined frontend languages to argos language object.
if args.frontend_language_source == "auto": if args.frontend_language_source == "auto":
frontend_argos_language_source = type( frontend_argos_language_source = type(