4 ms·
I just fixed dolphin-emu.org, this was a bug in our code that would not detect en-US as being "compatible" with en. See https://github.com/dolphin-emu/www/commi
by delroth 13y ago
I just fixed dolphin-emu.org, this was a bug in our code that would not detect en-US as being "compatible" with en. See https://github.com/dolphin-emu/www/commit/ddef974c6f601bc2dbbcc499c8990f4dd074615f https://github.com/dolphin-emu/www/commit/ddef974c6f601bc2db...
As a French guy leaving in the German part of Switzerland with Accept-Language configured to get English content, I'm kind of ashamed to have that kind of bug in my language detection code. I'm always complaining about other websites language detection, looks like I should have looked at my own code first!
- spacehunt 13y agoPlease don't do this... I detest sites that try to be clever and serve me Simplified Chinese even though I only have zh-hk in Accept-Language:.
- delroth 13y agoI already have exceptions for things like that. I think our code handles zh_{CN,TW,HK} separately, as well as things like pt_BR vs. pt. > curl -I -H 'Accept-Language: zh-hk,en;q=0.8' https://dolphin-emu.org/ HTTP/1.1 200 OK # No zh_HK translation (yet!) > curl -I -H 'Accept-Language: zh-cn,en;q=0.8' https://dolphin-emu.org/ HTTP/1.1 302 FOUND Location: http://cn.dolphin-emu.org/?cr=cn > curl -I -H 'Accept-Language: pt,en;q=0.8' https://dolphin-emu.org/ HTTP/1.1 200 OK # No pt translation (yet!) > curl -I -H 'Accept-Language: pt-br,en;q=0.8' https://dolphin-emu.org/ HTTP/1.1 302 FOUND Location: http://br.dolphin-emu.org/?cr=br i18n is hard but I think I've been doing a fairly good job on it. Proud to have more than 50% of our visitors from outside of the US!
- spacehunt 13y agoHaving now read the full code and not just the diff, I have to say it looks pretty good. I note that plain "zh" is not redirected to the cn site. ;) Whether it should or not is debatable though -- I actually think ignoring "zh" altogether is a rather prudent move if it is intentional.
- hc5 13y agoThanks! There is a corollary to this that would have prevented all this - when I went back in the Chrome settings and set the settings to the same order, it reset my header to this: "en-US,en;q=0.8,ko;q=0.6" - which makes things work for all sites again. I haven't touched my language settings since ~2012, so it's possible Chrome "fixed" this a while back, but didn't change my existing settings.