pymove3d.py
changeset 95 f0c34c057f0a
parent 90 57900b452c8b
child 97 9fa249552dba
     1.1 --- a/pymove3d.py	Fri Jan 17 17:17:34 2014 +0100
     1.2 +++ b/pymove3d.py	Fri Jan 17 18:08:39 2014 +0100
     1.3 @@ -7,45 +7,48 @@
     1.4  import logging
     1.5  from logging import Formatter
     1.6  
     1.7 -from flask.ext.babel import gettext
     1.8 +from flask.ext.babel import gettext as _
     1.9  from flask.ext.babel import Babel
    1.10  
    1.11 +from config import LANGUAGES
    1.12 +
    1.13 +
    1.14  app = Flask(__name__)
    1.15  babel = Babel(app)
    1.16  
    1.17  @babel.localeselector
    1.18  def get_locale():
    1.19 -    return "en" #request.accept_languages.best_match(LANGUAGES.keys())
    1.20 +    return request.accept_languages.best_match(LANGUAGES.keys())
    1.21  
    1.22  @app.route("/")
    1.23  
    1.24 -@app.route("/index")
    1.25 +@app.route(_("/index"))
    1.26  def index():
    1.27 -    return render_template("index.html")
    1.28 +    return render_template(_("en/index.html"))
    1.29  
    1.30 -@app.route("/competition")
    1.31 +@app.route(_("/competition"))
    1.32  def competition():
    1.33 -    return render_template("competition.html", act="competition")
    1.34 +    return render_template(_("en/competition.html"), act="competition")
    1.35  
    1.36 -@app.route("/task")
    1.37 +@app.route(_("/task"))
    1.38  def task():
    1.39 -    return render_template("task.html", act="task")
    1.40 +    return render_template(_("en/task.html"), act="task")
    1.41  
    1.42 -@app.route("/submission")
    1.43 +@app.route(_("/submission"))
    1.44  def submission():
    1.45 -    return render_template("submission.html", act="submission")
    1.46 +    return render_template(_("en/submission.html"), act="submission")
    1.47  
    1.48 -@app.route("/coursematerial")
    1.49 +@app.route(_("/coursematerial"))
    1.50  def coursematerial():
    1.51 -    return render_template("coursematerial.html", act="coursematerial")
    1.52 +    return render_template(_("en/coursematerial.html"), act="coursematerial")
    1.53  
    1.54 -@app.route("/imprint")
    1.55 +@app.route(_("/imprint"))
    1.56  def imprint():
    1.57 -    return render_template("imprint.html", act="imprint")
    1.58 +    return render_template(_("en/imprint.html"), act="imprint")
    1.59  
    1.60 -@app.route("/privacy")
    1.61 +@app.route(_("/privacy"))
    1.62  def privacy():
    1.63 -    return render_template("privacy.html", act="privacy")
    1.64 +    return render_template(_("en/privacy.html"), act="privacy")
    1.65  
    1.66  
    1.67  @app.errorhandler(404)
Impressum Datenschutzerklärung