Skip to content

Comment on Accept my accept-languageparent

Comments

I 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!

Having 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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.