pymove3d.py
changeset 95 f0c34c057f0a
parent 90 57900b452c8b
child 97 9fa249552dba
equal deleted inserted replaced
94:9a26e95f2f74 95:f0c34c057f0a
     5 import os
     5 import os
     6 from flask import send_from_directory
     6 from flask import send_from_directory
     7 import logging
     7 import logging
     8 from logging import Formatter
     8 from logging import Formatter
     9 
     9 
    10 from flask.ext.babel import gettext
    10 from flask.ext.babel import gettext as _
    11 from flask.ext.babel import Babel
    11 from flask.ext.babel import Babel
       
    12 
       
    13 from config import LANGUAGES
       
    14 
    12 
    15 
    13 app = Flask(__name__)
    16 app = Flask(__name__)
    14 babel = Babel(app)
    17 babel = Babel(app)
    15 
    18 
    16 @babel.localeselector
    19 @babel.localeselector
    17 def get_locale():
    20 def get_locale():
    18     return "en" #request.accept_languages.best_match(LANGUAGES.keys())
    21     return request.accept_languages.best_match(LANGUAGES.keys())
    19 
    22 
    20 @app.route("/")
    23 @app.route("/")
    21 
    24 
    22 @app.route("/index")
    25 @app.route(_("/index"))
    23 def index():
    26 def index():
    24     return render_template("index.html")
    27     return render_template(_("en/index.html"))
    25 
    28 
    26 @app.route("/competition")
    29 @app.route(_("/competition"))
    27 def competition():
    30 def competition():
    28     return render_template("competition.html", act="competition")
    31     return render_template(_("en/competition.html"), act="competition")
    29 
    32 
    30 @app.route("/task")
    33 @app.route(_("/task"))
    31 def task():
    34 def task():
    32     return render_template("task.html", act="task")
    35     return render_template(_("en/task.html"), act="task")
    33 
    36 
    34 @app.route("/submission")
    37 @app.route(_("/submission"))
    35 def submission():
    38 def submission():
    36     return render_template("submission.html", act="submission")
    39     return render_template(_("en/submission.html"), act="submission")
    37 
    40 
    38 @app.route("/coursematerial")
    41 @app.route(_("/coursematerial"))
    39 def coursematerial():
    42 def coursematerial():
    40     return render_template("coursematerial.html", act="coursematerial")
    43     return render_template(_("en/coursematerial.html"), act="coursematerial")
    41 
    44 
    42 @app.route("/imprint")
    45 @app.route(_("/imprint"))
    43 def imprint():
    46 def imprint():
    44     return render_template("imprint.html", act="imprint")
    47     return render_template(_("en/imprint.html"), act="imprint")
    45 
    48 
    46 @app.route("/privacy")
    49 @app.route(_("/privacy"))
    47 def privacy():
    50 def privacy():
    48     return render_template("privacy.html", act="privacy")
    51     return render_template(_("en/privacy.html"), act="privacy")
    49 
    52 
    50 
    53 
    51 @app.errorhandler(404)
    54 @app.errorhandler(404)
    52 def page_not_found(e):
    55 def page_not_found(e):
    53     return render_template("404.html"), 404
    56     return render_template("404.html"), 404
Impressum Datenschutzerklärung