What is the typical Chinese language code for the Accept-Language header?
Asked Answered
E

1

5

Unfortunately, I have no way to check this personally, so I wanted to ask the community about it.

According to RFC 5646, Chinese can have the following representation: zh-Hans for Simplified Chinese, zh-Hant for Traditional Chinese, or more specific: zh-Hans-SG for Simplified Chinese for Singapore, zh-Hant-MO for Traditional Chinese for Macau. This is not an exhaustive set of options, there are many.

One thing I know for sure - Chinese cannot be represented as follows: zh, or zh-CN, or zh-TW and the like.

However, how are things in reality? If the site is visited by a user who speaks Chinese, what can I expect in the Accept-Language header?

Estimative answered 25/10, 2021 at 14:27 Comment(0)
E
9

Well, I got the Windows Sandbox installed and I was able to install whatever I wanted there.

I checked two browsers:

  1. QQ browser (Chinese is selected by default, I'm not sure which script).
  2. Google Chrome (added all supported Chinese languages ​​and made them first on the list).

QQ sends in the request the following content in the accept-language header: zh-CN, zh; q = 0.9.

Google Chrome sends the following content in the accept-language header: zh-CN, zh-TW; q = 0.9, zh-HK; q = 0.8, zh; q = 0.7, en; q = 0.6, also I figured out what Chrome means under the indicated codes:

  • zh-CN - Chinese (Simplified)
  • zh-TW - Chinese (Traditional)
  • zh-HK - Chinese (Hong Kong)
  • zh - Chinese

To be honest, this is strange, but it is a fact.

Estimative answered 26/10, 2021 at 6:47 Comment(1)
Found this post as I'm working on translating a .Net WPF (desktop) app to Chinese, and was somewhat surprised to see that it reports the culture as "zh-CN", not "zh-Hans" (which I assumed it would be). .Net reports "zh-Hans" as being the parent of "zh-CN", while "zh" is the parent of "zh-Hans", but I've no idea why there are three levels in this culture hierarchy, whereas most only have two (e.g. "en-US" -> "en").Polybasite

© 2022 - 2024 — McMap. All rights reserved.