by delroth · 12y ago · 0 comments
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!
> 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!