On my website use Flask + Jinja2, and Flask-Babel for translation. The site has two languages (depending on the URL), and I'd want to add a link to switch between them. To do this correctly I need to get the name of the current locale, but I didn't find such function in the docs. Does it exist at all?
Finally, I used this solution: add get_locale
function, which should be defined anyway, to Jinja2 globals, and then call it in template like any other function.