ashcrow/flask-track-usage

Is it possible to get accept_languages instead of user_agent.language

Ben-Bock opened this issue · 6 comments

Thank you so much for creating this great package!

When I'm using it in most of the cases the ua_language is empty.

I think it's because of the usage of request.user_agent.language instead of request.accept_languages.
Browsers don't so often set the language but the accepted lanuages should be there nearly every time.

A change here may be a very great thing.

Thank you so much!

Thank you for the kind words @Ben-Bock! That sounds like a good idea. What are your thoughts on priority of the fields? Should it be request.user_agent.language first and, if empty, use request.accept_languages?

Hi, that makes sense to only go for the accepted if the other is not set explicit.
Maybe there could also be an option if one just wants to have the 1st (highest) or all accepted languages – Thx.

Sounds good. I'll take a look at this.

I've started to look at how to plumb this through storage. Would you be up for helping test once I have some code up for review?

Hi, yes sure, happy to test that once it's available.

I haven't forgot about this :-) I should have some code up near the end of the week.