equal
deleted
inserted
replaced
10 from flask.ext.babel import gettext as _ |
10 from flask.ext.babel import gettext as _ |
11 from flask.ext.babel import Babel |
11 from flask.ext.babel import Babel |
12 |
12 |
13 from config import LANGUAGES |
13 from config import LANGUAGES |
14 from sayings import get_saying |
14 from sayings import get_saying |
|
15 from jinja2 import Environment, FileSystemLoader |
15 |
16 |
16 LANGUAGE_SELECTED = "de" |
17 LANGUAGE_SELECTED = "de" |
17 #ToDo after engelish is implemented set LANGUAGE_SELECTED = None |
18 #ToDo after engelish is implemented set LANGUAGE_SELECTED = None |
18 |
19 |
19 app = Flask(__name__) |
20 app = Flask(__name__) |
20 babel = Babel(app) |
21 babel = Babel(app) |
|
22 |
|
23 def get_topmenue(): |
|
24 |
|
25 topmenue = [('/competition', _('Competition')), |
|
26 ('/task', _('Task')), |
|
27 ('/submission', _('Submission')), |
|
28 ('/coursematerial', _('Coursematerial')), |
|
29 ] |
|
30 |
|
31 return topmenue |
|
32 |
|
33 app.jinja_env.globals.update(get_topmenue=get_topmenue) |
|
34 |
21 |
35 |
22 @babel.localeselector |
36 @babel.localeselector |
23 def get_locale(): |
37 def get_locale(): |
24 """ToDo: if translation is completed, switch to en """ |
38 """ToDo: if translation is completed, switch to en """ |
25 return LANGUAGE_SELECTED or request.accept_languages.best_match(LANGUAGES.keys()) or 'de' |
39 return LANGUAGE_SELECTED or request.accept_languages.best_match(LANGUAGES.keys()) or 'de' |