Commit 282a39ee6f7555f4a6619a7d1265583a332f1398
1 parent
36732d9cff
Exists in
master
add current language to app.config
Showing 4 changed files with 4 additions and 1 deletions Side-by-side Diff
__pycache__/main.cpython-310.pyc
No preview for this file type
k2/__pycache__/root.cpython-310.pyc
No preview for this file type
k2/root.py
| ... | ... | @@ -102,6 +102,7 @@ |
| 102 | 102 | @components_bp.route('/change_language/<lang>') |
| 103 | 103 | def change_language(lang): |
| 104 | 104 | session['lang'] = lang |
| 105 | + app.config['CURRENT_LANGUAGE'] = lang | |
| 105 | 106 | return redirect(url_for('components.dashboard')) |
| 106 | 107 | |
| 107 | 108 | @components_bp.route('/dashboard') |
| ... | ... | @@ -132,7 +133,8 @@ |
| 132 | 133 | 'description'] else False)] |
| 133 | 134 | else: |
| 134 | 135 | filtered_components = component_server |
| 135 | - current_language = get_locale() | |
| 136 | + current_language = app.config['CURRENT_LANGUAGE'] #get_locale() | |
| 137 | + | |
| 136 | 138 | return render_template('dashboard.html', components=components, |
| 137 | 139 | components_names=components_names, component_server=filtered_components, |
| 138 | 140 | search_query=search_query, language=current_language) |
main.py
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | app.config['SECRET_KEY'] = 'JH&INH987gFDHdsagh&8dwbjdw8ckw' |
| 19 | 19 | app.config['DOMAIN'] = 'http://127.0.0.1:5001/' |
| 20 | 20 | app.config['DEFAULT_LANGUAGE'] = 'en' |
| 21 | +app.config['CURRENT_LANGUAGE'] = '' | |
| 21 | 22 | app.config['BABEL_TRANSLATION_DIRECTORIES'] = 'languages;components/k2test/k2test/languages' |
| 22 | 23 | |
| 23 | 24 | # setting flask app |