Merge main
authorstetrabby <info@trabucchi.de>
Sat, 18 Jan 2014 14:56:40 +0100
changeset 1214cdccfbac02c
parent 120 66952846a7a7 (current diff)
parent 118 8f3447e7f36e (diff)
child 122 cafae4de01b3
Merge main
     1.1 --- a/pymove3d.py	Sat Jan 18 14:54:33 2014 +0100
     1.2 +++ b/pymove3d.py	Sat Jan 18 14:56:40 2014 +0100
     1.3 @@ -12,6 +12,7 @@
     1.4  
     1.5  from config import LANGUAGES
     1.6  
     1.7 +LANGUAGE_SELECTED = None
     1.8  
     1.9  app = Flask(__name__)
    1.10  babel = Babel(app)
    1.11 @@ -19,15 +20,26 @@
    1.12  @babel.localeselector
    1.13  def get_locale():
    1.14      """ToDo: if translation is completed, switch to en """
    1.15 -    return request.accept_languages.best_match(LANGUAGES.keys()) or 'de'
    1.16 +    return LANGUAGE_SELECTED or request.accept_languages.best_match(LANGUAGES.keys()) or 'de'
    1.17  
    1.18  
    1.19  @app.route("/")
    1.20 -
    1.21  @app.route("/index")
    1.22  def index():
    1.23      return render_template(get_locale() + "/index.html")
    1.24  
    1.25 +@app.route('/de')
    1.26 +def de():
    1.27 +    global LANGUAGE_SELECTED
    1.28 +    LANGUAGE_SELECTED = "de"
    1.29 +    return render_template("/de/index.html")
    1.30 +
    1.31 +@app.route('/en')
    1.32 +def en():
    1.33 +    global LANGUAGE_SELECTED
    1.34 +    LANGUAGE_SELECTED = "en"
    1.35 +    return render_template("/en/index.html")
    1.36 +
    1.37  @app.route("/competition")
    1.38  def competition():
    1.39      return render_template(get_locale() + "/competition.html", act="competition")
Impressum Datenschutzerklärung