Add basic Dutch translations by jelle619 and translation scripts

This commit is contained in:
Jeremy Zhang
2017-11-16 03:09:53 +00:00
parent f95cd7060c
commit 3007266556
6 changed files with 193 additions and 9 deletions

View File

@ -6,6 +6,7 @@ from titanembeds.utils import rate_limiter, discord_api, socketio, babel
from .blueprints import api, user, admin, embed, gateway
import os
from titanembeds.database import get_administrators_list
from titanembeds.i18n import LANGUAGES
try:
import uwsgi
@ -41,6 +42,13 @@ app.register_blueprint(user.user, url_prefix="/user", template_folder="/template
app.register_blueprint(embed.embed, url_prefix="/embed", template_folder="/templates")
socketio.on_namespace(gateway.Gateway('/gateway'))
@babel.localeselector
def get_locale():
param_lang = request.args.get("lang", None)
if param_lang in LANGUAGES:
return param_lang
return request.accept_languages.best_match(LANGUAGES.keys())
@app.route("/")
def index():
return render_template("index.html.j2")