flask-track-usage icon indicating copy to clipboard operation
flask-track-usage copied to clipboard

Is it possible to get accept_languages instead of user_agent.language

Open Ben-Bock opened this issue 4 years ago • 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!

Ben-Bock avatar Aug 05 '21 14:08 Ben-Bock

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?

ashcrow avatar Aug 05 '21 19:08 ashcrow

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.

Ben-Bock avatar Aug 06 '21 09:08 Ben-Bock

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

ashcrow avatar Aug 09 '21 14:08 ashcrow

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?

ashcrow avatar Aug 16 '21 14:08 ashcrow

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

Ben-Bock avatar Aug 20 '21 15:08 Ben-Bock

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

ashcrow avatar Sep 14 '21 21:09 ashcrow