1

I'm working on a website that I need to optimize for multiple-languages. I want to provide support in 3-4 languages, 'en', 'de', 'cn' - the trouble is, I'm not sure what Saudi-Arabia and the gulf countries use.

Is there an authoritative document that lists out the mappings between nationstate => 'lang-value'? Where can I find such a document? What web standard covers this?

2 Answers 2

3

As you want to use HTML5, you should consult the only document that matters, the HTML5 specification:

  1. The HTML5 spec is http://www.w3.org/TR/2014/REC-html5-20141028/.

  2. Search for "lang", and you’ll find the section The lang and xml:lang attributes.

  3. There it defines:

    Its value must be a valid BCP 47 language tag, or the empty string.

  4. "BCP47" is linked in the references: Tags for Identifying Languages; Matching of Language Tags. A more accessible version of this document (HTML instead of plain text) is https://tools.ietf.org/html/bcp47.

  5. There it says that all values are registered in the Language Subtag Registry at iana.org, which would be https://www.iana.org/assignments/language-subtag-registry.

  6. Search for the language you are interested in.

    The block has to be of type "language", and the language code (which can be used as value for lang) is listed as "Subtag".

    Make sure that you don’t use a value of type "region". Saudi Arabia, for example, has the region subtag SA, while the language Sanskrit has the language subtag sa.

As explained in BCP 47, you can add a region to a language. You could, for example, use lang="en-SA", which could mean something like "English as spoken/written in Saudi Arabia", or "English for users in Saudi Arabia".

Related links

1
  • Following this, you’ll see that there is no language subtag cn defined.
    – unor
    Dec 16, 2014 at 13:25
1

The spec www.w3.org/TR/html401/struct/dirlang.html#h-8.1 says that language codes come from RFC1766 http://www.ietf.org/rfc/rfc1766.txt, which says:

The following registrations are predefined:

In the primary language tag:

  • All 2-letter tags are interpreted according to ISO standard 639, "Code for the representation of names of languages" [ISO 639].
  • The value "i" is reserved for IANA-defined registrations
  • The value "x" is reserved for private use. Subtags of "x" will not be registered by the IANA.
  • Other values cannot be assigned except by updating this standard.

wikipedia/List_of_ISO_639-1_codes --SLaks https://stackoverflow.com/questions/27497213/where-do-i-get-a-list-of-attribute-lang-values-what-standard-covers-this-fo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.