It 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.
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.)
This is happening for me too and I came to the same conclusion.
My request headers:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8,he;q=0.7
Cache-Control: max-age=0
Connection: keep-alive
Host: wttr.in
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
And then the page displays in Hebrew, even though this is the least preferred language in my request.

FYI, Hebrew is also mostly broken on the result page. May I suggest pulling back RTL languages until the page can properly format them?
wttr.in currently does not respect q parameter. What's more interesting is that copying the functions reveal they are working properly (tested both on Python 2 and 3):
$ python
>>> # functions pasted here, with exception of `if lang in SUPPORTED_LANGS`...
>>> _find_supported_language(_parse_accept_language("en-US,en;q=0.9,nl;q=0.8"))
'en'
Does Flask reorder header content or what?
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().
Seems a duplicate of #116
The problem is fixed by @talyian in #304. Please test
Looks like it fixed it for me!
On Sun, Jul 7, 2019 at 12:55 PM Igor Chubin notifications@github.com
wrote:
The problem is fixed by @talyian https://github.com/talyian in #304
https://github.com/chubin/wttr.in/pull/304. Please test—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/chubin/wttr.in/issues/194?email_source=notifications&email_token=AAF7ODZB6SQ3ZL64QMCQN4LP6JCZJA5CNFSM4E7JL2IKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZLR6PY#issuecomment-509026111,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAF7OD665Y5JCM7TRJX3QI3P6JCZJANCNFSM4E7JL2IA
.
Most helpful comment
Slight correction, the language with the highest
qvalue should be chosen. (Which most browsers will make the first in the list, but it's not mandatory.)