Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What standard do language codes of the form "zh-Hans" belong to?

Tags:

Through the REST API of an application, I receive language codes of the following form: ll-Xxxx.

  • two lowercase letters languages (looks like ISO 639-1),
  • a dash,
  • a code going up to four letters, starting with an uppercase letter (looks like an ISO 639-3 macrolanguage code).

Some examples:

az-Arab Azerbaijani in the Arabic script az-Cyrl Azerbaijani in the Cyrillic script az-Latn Azerbaijani in the Latin script  sr-Cyrl Serbian in the Cyrillic script sr-Latn Serbian in the Latin script  uz-Cyrl Uzbek in the Cyrillic script uz-Latn Uzbek in the Latin script  zh-Hans Chinese in the simplified script zh-Hant Chinese in the traditional script 

From what I found online:

[ISO 639-1] is the first part of the ISO 639 series of international standards for language codes. Part 1 covers the registration of two-letter codes.

and

ISO 639-3 is an international standard for language codes. In defining some of its language codes, some are defined as macrolanguages [...]

Now I need to write a piece of code to verify that I receive a valid language code.
But since what I receive is a mix of 639-1 (2 letters language) and 639-3 (macrolanguage), what standard am I supposed to stick with ? Are these code belonging to some sort of mixed up (perhaps common) standard ?

like image 322
Anto Avatar asked Sep 19 '13 18:09

Anto


People also ask

What language is zh Hans?

For example, "zh-Hant" and "zh-Hans" represent Chinese written in Traditional and Simplified scripts respectively, while the language subtag "en" has a "Suppress-Script" field in the registry indicating that most English texts are written in the Latin script, discouraging a tag such as "en-Latn-US".

Is zh traditional or simplified?

From various sources it looks like zh-CN is Simplified Chinese and zh-TW is Traditional Chinese.

Why is the code for Chinese zh?

When zh is used on its own, it is usually used to mean the predominant language in the encompassed range, although this is not explicitly specified in BCP 47. For example, conventionally zh is considered to represent the predominant, Mandarin form of Chinese.

Is zh-CN Traditional Chinese?

The standard locale for simplified Chinese is zh_CN . The standard locale for traditional Chinese is zh_TW .


1 Answers

The current reference for identifying languages is IETF BCP 47, which combines IETF RFC 5646 and RFC 4647.

Codes of the form ll-Xxxx combine an ISO 639-1 language code (two letters) and an ISO 15924 script code (four letters). BCP 47 recommends that language codes be written in lower case and that script codes be written "lowercase with the initial letter capitalized", but this is basically for readability.

BCP 47 also recommends that the language code should be the shortest available ISO 639 tag. So if a language is represented in both ISO 639-1 (two letters) and ISO 639-3 (three letters), than you should use the ISO 639-1.

like image 131
Tsundoku Avatar answered Oct 02 '22 09:10

Tsundoku