Language order not respected correctly
See original GitHub issueIt turns out that if you provide a header with language options,
e.g. curl -H 'Accept-Language: en-US,en;q=0.9,nl;q=0.8' wttr.in/~Portland
The system provides a response in the least-preferred language, e.g.:
Weerbericht voor: Portland
\ / Gedeeltelijk bewolkt
_ /"".-. 59 °F
\_( ). → 4 mph
/(___(__) 9 mi
0.0 in
This is incorrect. The first language in the list is the one that the site should choose for localization.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Word, Outlook not respecting language settings, not detecting ...
Word, Outlook not respecting language settings, not detecting language automatically. Hi,. I run Win 10 (1803) in English, keyboard ch-EN, ...
Read more >Setting language preferences in a browser - W3C
Sometimes a server may determine which language to send to you in a way that doesn't rely on the Accept-Language information.
Read more >Speech (sound) disorder - Raising Children Network
Children with speech disorders can understand words and sentences well and form phrases and sentences correctly. Children with language ...
Read more >How Does Word Order Work? - Babbel
In this article, we look at every possible word order, what languages use them and what it would look like if English used...
Read more >Word order - Wikipedia
However, even languages with flexible word order have a preferred or basic word order, with other word orders considered "marked". Constituent word order...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Slight correction, the language with the highest
q
value should be chosen. (Which most browsers will make the first in the list, but it’s not mandatory.)The problem here seems to be that “en” has a somewhat of a “special status”: It’s the “default” language when no other language is specified, but not int he list of supported languages (SUPPORTED_LANGS). When “en” appears in the “Accept-Language” header, it is completely ignored by
_find_supported_language()
.This looks like a simple fix: Either add “en” to the list of supported languages (don’t know the side effects of it), or special case “en” in
_find_supported_language()
.