Template:Lang/doc: Difference between revisions

From AnthroWiki
(Created page with "{{Thousandfold}} == Syntax and usage == <code><nowiki>{{lang|language tag|text}}</nowiki></code> The ''language tag'' should consist of an w:Lists of ISO 639 codes|ISO 6...")
 
No edit summary
Line 3: Line 3:
== Syntax and usage ==
== Syntax and usage ==


<code><nowiki>{{lang|language tag|text}}</nowiki></code>
<code><nowiki>{{lang|language tag|text}}</nowiki></code>


The ''language tag'' should consist of an [[w:Lists of ISO 639 codes|ISO 639]] language code.  The template supports properly formatted [[w:IETF language tag|IETF language tag]]s using subtags that identify the language's script, region, and/or variant. The ISO 639 language code is a two- or three-letter abbreviation, in lowercase, of the language's name. French, for example, has the code <code>fr</code>:
The ''language tag'' should consist of an [[w:Lists of ISO 639 codes|ISO 639]] language code.  The template supports properly formatted [[w:IETF language tag|IETF language tag]]s using subtags that identify the language's script, region, and/or variant. The ISO 639 language code is a two- or three-letter abbreviation, in lowercase, of the language's name. French, for example, has the code <code>fr</code>:


<code><nowiki>She said: "{{lang|fr|Je suis française.}}"</nowiki></code> → She said: "{{lang|fr|Je suis française.}}"
<code><nowiki>She said: "{{lang|fr|Je suis française.}}"</nowiki></code> → She said: "{{lang|fr|Je suis française.}}"


Because all languages represented by two-letter codes in [[w:ISO 639-1|ISO 639-1]] can also be represented by their three-letter equivalents in [[w:ISO 639-2|ISO 639-2]] and above, it is recommended to use the shortest language tag possible that sufficiently describes the target language.<ref>[https://www.w3.org/International/articles/language-tags/index.en "Language tags in HTML and XML"] at [[World Wide Web Consortium]]</ref> So while French could be represented by 639‑2's <code>fra</code> code, use the 639‑1 code <code>fr</code> instead. Likewise, script, region, and variant information should be included only when they provide a necessary distinction. For an up-to-date list of available language, script, region, and variant codes, please refer to the [[w:Internet Assigned Numbers Authority|IANA]]'s [http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry language subtag registry].
Because all languages represented by two-letter codes in [[w:ISO 639-1|ISO 639-1]] can also be represented by their three-letter equivalents in [[w:ISO 639-2|ISO 639-2]] and above, it is recommended to use the shortest language tag possible that sufficiently describes the target language.<ref>[https://www.w3.org/International/articles/language-tags/index.en "Language tags in HTML and XML"] at [[w:World Wide Web Consortium|]]</ref> So while French could be represented by 639‑2's <code>fra</code> code, use the 639‑1 code <code>fr</code> instead. Likewise, script, region, and variant information should be included only when they provide a necessary distinction. For an up-to-date list of available language, script, region, and variant codes, please refer to the [[w:Internet Assigned Numbers Authority|IANA]]'s [http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry language subtag registry].
 
== References ==
 
<references />

Revision as of 14:36, 19 February 2021

This template is integrated many times. If you know exactly what the effects are, you can edit it. In most cases, however, it makes sense to first vote on change requests on Template Discussion.

Syntax and usage

{{lang|language tag|text}}

The language tag should consist of an ISO 639 language code. The template supports properly formatted IETF language tags using subtags that identify the language's script, region, and/or variant. The ISO 639 language code is a two- or three-letter abbreviation, in lowercase, of the language's name. French, for example, has the code fr:

She said: "{{lang|fr|Je suis française.}}" → She said: "Je suis française."

Because all languages represented by two-letter codes in ISO 639-1 can also be represented by their three-letter equivalents in ISO 639-2 and above, it is recommended to use the shortest language tag possible that sufficiently describes the target language.[1] So while French could be represented by 639‑2's fra code, use the 639‑1 code fr instead. Likewise, script, region, and variant information should be included only when they provide a necessary distinction. For an up-to-date list of available language, script, region, and variant codes, please refer to the IANA's language subtag registry.

References

  1. "Language tags in HTML and XML" at [[w:World Wide Web Consortium|]]