SnookerC
SnookerC

Reputation: 170

What culture code should I use for Pinyin?

My Question

If you want to display Pinyin for Chinese-speaking users, in what "resource file" would you store the Pinyin translation?

Since Pinyin is NOT a "language" per se, but a Latin representation of Chinese characters, it does NOT have a culture code in .NET.

My guess is that we probably need to use the applicable "zh-" (Chinese) cultures and simply place the latin character Pinyin translation inside those resource files.

I apologize in advance if this is a stupid question, but all the different culture stuff is scrambling my brain!!

Background

We're finally getting around to Internationalization of our Web sites. We're handling most of the "Western" cultures okay now (Latin alphabet: "es", "fr", "de") and the different date/number formats. However, the ideogram-based writing systems like Chinese are a challenge due to various legacy systems not handling Unicode. As a short-term workaround, our business area decided to use Pinyin for Chinese speaking users.

So... the business area asked me to "just add a Pinyin resource file" to the site.

Upvotes: 2

Views: 808

Answers (2)

jrc
jrc

Reputation: 21939

Short answer: zh-Latn-pinyin, zh-Latn-CN-pinyin, cmn-Latn-pinyin would all be valid.

The IANA Language Subtag Registry defines the variant subtag pinyin, to be used with prefix zh-Latn for Chinese (and bo-Latn for Tibetan).

W3C's recommendation:

Check the context and ordering for variant subtags. Most variant subtag records in the registry have one or more Prefix fields. The prefixes indicate with which subtags it is usually appropriate to use this variant. For example, pinyin should generally be used in a language tag that also contains either the subtags zh and Latn or the subtags bo and Latn, since the entry for pinyin contains the following:

Prefix: zh-Latn
Prefix: bo-Latn

If you have a good reason, you could use a variant subtag with different subtags, eg. cmn-Latn-pinyin would be a perfectly legal way to say Mandarin Chinese written with pinyin.

Although zh, bo and Latn are specified, this is a minimum requirement. It is also possible to include other subtags, such as a region subtag, in the language tag (where appropriate), eg. zh-Latn-CN-pinyin.

https://www.w3.org/International/questions/qa-choosing-language-tags#variants

Upvotes: 1

Bojin Li
Bojin Li

Reputation: 5799

The Microsoft culture code is in the format of :

"language-country" 

So, take Chinese for example. The code for Chinese is "zh". However, there are many countries and regions that use Chinese, so we append a country code to the language code. "zh-cn" stands for Chinese-Mainland China. Similarly, "zh-tw" represents Chinese for Taiwan.

.Net uses the concept of resource fallback, where resource lookups begins at the level specified and as long as the resource is not found, a less specific resource will be looked at until we get to the default resource. So ideally, the "zh-cn" resource file should contain only resources that are specific to Mainland China. All resources that are common to all Chinese speaking countries should reside in the "zh" resource.

So getting to your question, I believe Pinyin is primarily used in mainland China, and since you are using it as a Chinese translation substitute, I would place the Pinyin translations inside the "zh-cn" resource file.

Upvotes: 1

Related Questions