Mobile app version of vmapp.org
Login or Join
Alves908

: Where do I get a list of attribute 'lang' values - what standard covers this, for SEO optimization? I'm working on a website that I need to optimize for multiple-languages. I want to provide

@Alves908

Posted in: #Html5 #LangAttribute #Language

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Alves908

2 Comments

Sorted by latest first Latest Oldest Best

 

@Sherry384

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


The HTML5 spec is www.w3.org/TR/2014/REC-html5-20141028/. Search for "lang", and you’ll find the section The lang and xml:lang attributes.
There it defines:


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

"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 tools.ietf.org/html/bcp47. There it says that all values are registered in the Language Subtag Registry at iana.org, which would be www.iana.org/assignments/language-subtag-registry. 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


Wikipedia: IETF language tag
W3C: Choosing a Language Tag
W3C: Language tags in HTML and XML

10% popularity Vote Up Vote Down


 

@Lengel546

The spec w3.org/TR/html401/struct/dirlang.html#h-8.1 says that language codes come from RFC1766 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 stackoverflow.com/questions/27497213/where-do-i-get-a-list-of-attribute-lang-values-what-standard-covers-this-fo

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme