I have the function in Flask, which returns the website in english. Moreover, i want to be able to use german in the website at a button push from html. How can I change the language at a button push from english to german and from german to english? Also, is it possible to use the function get_locale only at call, not running automatically?
@babel.localeselector
def get_locale():
return 'en'
At first You need to store the address at the main app file:
Than You need to change to the same addess to get_locale function in main app file:
To access current language from template:
Here the template file: