Language tags

A language tag is a tool authors can use to specify the language in which content is presented in an element or in an HTML document. For this purpose, HTML provides a series of language attributes like, for example, lang or hreflang.

Language tags can be composed by many types of subtags separated from each other by hypens ("-"). These subtags make a language more specific by declaring, for example, an extension, a region where it's used or a script. A language tag must conform with the following structure, where some of the subtags may be ommited.

[primary_language]-[extended_language]-[script]-[region]-[variant]

Language subtags

The following list describes briefly the purpose of each language subtag.

Primary language subtag
Defines the primary language used. It's required, unless an extended language is declared. Some examples could be english ("en"), spanish ("es"), french ("fr"), etc.
Extended language subtag
Specifies a dialect, variety, specificity or extension of the primary language. When present, the primary language subtag can be ommited. Some examples are cantonese chinese ("zh-yue" or "yue"), Gulf Arabic ("ar-afb" or "afb"), greek sign language ("sgn-gss" or "gss"), etc.
Script subtag
Indicates the script used to write the text this language tag is affecting. It's rarely meeded as most languages have a default script associated to them (like latin script for spanish). Some examples are simplified chinese ("zh-Hans"), traditional chinese ("zh-Hant"), azerbaijani written in Latin script ("az-Latn"), etc.
Region subtag
Provides a region where the language is used. Some examples are latin-american spanish ("es-419"), spanish spoken in Spain ("es-ES"), english used in the United Kingdoms ("en-UK"), etc.
Variant subtag
Indicates dialect or script variations not already covered by combinations of the previous subtags. Some examples are the Nadiza dialect of Slovenian ("sl-nedis"), the Rezijan dialect of Slovenian ("sl-rozaj"), the variant of German orthography dating from the 1901 reforms as seen in Switzerland ("de-CH-1901"), etc.

Language tag generator

Choosing the appropriate language tag for your content may be a simple or complicated process, depending on the specificity of the language used. With the following form you can compose a language tag by searching and choosing each subtags in a user-friendly way.

Primary language:

Extended language:

Script:

Region:

Variant:

Additional variant:

Second additional variant:

[NO_DATA]