Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tiritibambix committed Jan 12, 2025
1 parent d6f04a1 commit d09e5a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@
os.makedirs(OUTPUT_FOLDER, exist_ok=True)

app = Flask(__name__)
babel = Babel(app)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.config['OUTPUT_FOLDER'] = OUTPUT_FOLDER
app.config['BABEL_DEFAULT_LOCALE'] = 'en'
app.config['BABEL_TRANSLATION_DIRECTORIES'] = 'translations'
app.secret_key = 'supersecretkey'
app.logger.setLevel(logging.INFO)

@babel.localeselector
def get_locale():
# Essaie d'obtenir la langue depuis le paramètre 'lang' de l'URL
lang = request.args.get('lang')
Expand All @@ -46,6 +44,8 @@ def get_locale():
# Sinon, utilise la langue du navigateur
return request.accept_languages.best_match(LANGUAGES)

babel = Babel(app, locale_selector=get_locale)

def allowed_file(filename):
"""Allow all file types supported by ImageMagick."""
return '.' in filename
Expand Down

0 comments on commit d09e5a9

Please sign in to comment.