python flask detect browser language
![](https://i-blog.csdnimg.cn/blog_migrate/f5b0adb0df467830b5b6a7c3dae8229b.png)
No problem. We won't show you that ad again. Why didn't you like it?
- Uninteresting
- Misleading
- Offensive
- Repetitive
- Other
![](http://engine.adzerk.net/i.gif?e=eyJhdiI6NDE0LCJhdCI6NCwiYnQiOjAsImNtIjo0MDQyODMsImNoIjoxMTc4LCJjayI6e30sImNyIjoxNDM0MzAzLCJkaSI6IjdhNDM2M2YyODY5MjQxMThiMGMwZGNiOGQyYWQ5YmYwIiwiZG0iOjEsImZjIjoxNjQ5MzAwLCJmbCI6MTQ0ODM0MiwiaXAiOiIyMDguMTQ2LjQzLjUiLCJrdyI6InB5dGhvbixmbGFzayIsIm53IjoyMiwicGMiOjAsImVjIjowLCJwciI6MTYwNCwicnQiOjEsInN0Ijo4Mjc3LCJ1ayI6InVlMS01YzI3NGI0NDViMzI0NzM0YWIyMmNlMDgzNDZjYzllNyIsInpuIjo0MywidHMiOjE0NjUzNDQzNjkwOTksImJmIjp0cnVlLCJwbiI6ImFkemVyazEwMTg5MTgyNjMiLCJmcSI6MH0&s=TKNxGXS3zNYp_YoNZeXPUWUP9GI)
You should check | |||||
|
No problem. We won't show you that ad again. Why didn't you like it?
- Uninteresting
- Misleading
- Offensive
- Repetitive
- Other
![](http://engine.adzerk.net/i.gif?e=eyJhdiI6NjMzMDUsImF0Ijo0LCJidCI6MCwiY20iOjM4Njg1MCwiY2giOjExNzgsImNrIjp7fSwiY3IiOjE0NDQ3ODAsImRpIjoiZjFjMGM2ZDI5MDRjNDZhNWFhNGRmZGEyOWE1ZjE3MmUiLCJkbSI6MSwiZmMiOjE2NjUzNTgsImZsIjoxNTA3MTA5LCJpcCI6IjIwOC4xNDYuNDMuNSIsImt3IjoicHl0aG9uLGZsYXNrIiwibWsiOiJweXRob24iLCJudyI6MjIsInBjIjoyLjUsImVjIjoyLjUsInByIjo3NjUsInJ0IjoyLCJzdCI6ODI3NywidWsiOiJ1ZTEtNWMyNzRiNDQ1YjMyNDczNGFiMjJjZTA4MzQ2Y2M5ZTciLCJ6biI6NDQsInRzIjoxNDY1MzQ0MzY5MTAxLCJiZiI6dHJ1ZSwicG4iOiJhZHplcmsxMjUyOTI1MjM1IiwiZnEiOjB9&s=IC4eHtRVcVy4Bw4pFI5hUt_MipM)
Check out Werkzeug's LanguageAccept data structure, or just try something like this to get a best match:
If you need more than that, then check out Flask-Babel. |
print(request.headers)
to see what is in there? – IanAuld May 25 '15 at 14:50