mirror of
https://github.com/Mailu/Mailu.git
synced 2025-01-16 02:46:44 +02:00
Select translation based on browser configuration, fixes #100
This commit is contained in:
parent
9f09e0c8e0
commit
d4f93e39db
@ -40,6 +40,7 @@ migrate = flask_migrate.Migrate(app, db)
|
||||
login_manager = flask_login.LoginManager()
|
||||
login_manager.init_app(app)
|
||||
babel = flask_babel.Babel(app)
|
||||
translations = list(map(str, babel.list_translations()))
|
||||
|
||||
# Manager commnad
|
||||
manager = flask_script.Manager(app)
|
||||
@ -48,6 +49,11 @@ manager.add_command('db', flask_migrate.MigrateCommand)
|
||||
# Connect to the Docker socket
|
||||
dockercli = docker.Client(base_url=app.config['DOCKER_SOCKET'])
|
||||
|
||||
# Babel configuration
|
||||
@babel.localeselector
|
||||
def get_locale():
|
||||
return flask.request.accept_languages.best_match(translations)
|
||||
|
||||
# Finally setup the blueprint and redirect /
|
||||
from mailu import admin
|
||||
app.register_blueprint(admin.app, url_prefix='/admin')
|
||||
|
Loading…
Reference in New Issue
Block a user