aboutsummaryrefslogtreecommitdiff
path: root/budget/run.py
diff options
context:
space:
mode:
Diffstat (limited to 'budget/run.py')
-rw-r--r--budget/run.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/budget/run.py b/budget/run.py
index 39b297e..9bb07f4 100644
--- a/budget/run.py
+++ b/budget/run.py
@@ -1,4 +1,4 @@
-from web import main, db, mail
+from web import main, db, mail, babel
from api import api
import os
@@ -10,7 +10,6 @@ app.config.from_object("default_settings")
app.register_blueprint(main)
app.register_blueprint(api)
-
# db
db.init_app(app)
db.app = app
@@ -19,6 +18,14 @@ db.create_all()
# mail
mail.init_app(app)
+# translations
+babel.init_app(app)
+
+@babel.localeselector
+def get_locale():
+ return request.accept_languages.best_match(['fr', 'en'])
+
+
def main():
app.run(host="0.0.0.0", debug=True)