• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Lang-x2

  • Template
  • Talk
  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]
This template should not be used in citation templates such as Citation Style 1 and Citation Style 2, because it includes markup that will pollute the COinS metadata they produce; see Wikipedia:COinS.
This template uses Lua:
  • Module:Lang/utilities
  • Module:Lang (sandbox)
Language templates
Language names (ISO 639)
  • {{ISO 639 name}}
Interwiki links
  • {{Wikt-lang}}
  • Module:Wikt-lang
  • Module:Wikt-lang/data
  • {{Interlanguage link}}
Foreign-language text
  • {{Lang}}
  • {{Langx}}
  • Module:Lang
  • {{Transliteration}}
  • {{Title language}}
Other
  • {{IPA}}
  • v
  • t
  • e

The purpose of this template is to indicate that two spans of text belong to a particular language; one in non-Latin script and the other in a Latin script that is not a transliteration or romanization of the non-Latin text. This template finds application with languages that have native alphabets that are equal in status; Serbo-Croatian for example.

Contents

  • 1 Syntax and usage
  • 2 Parameters
  • 3 Examples
  • 4 Error messages
  • 5 Tracking categories
  • 6 See also
  • 7 References
  • 8 External links

Syntax and usage

The minimal implementation has the form:

{{lang-x2|<language tag>|<Latin text>|<non-Latin text>}}

where the three required parameters are:

<language tag> – ISO-639 language code (click here for list of most codes); unlike {{lang}}, this template does not accept IETF language tags
<Latin text> – the Latin-script text; must be written only using Latin Unicode characters
<non-Latin text> – the non-Latin-script text; must not be written using Latin Unicode characters

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.

By default, this template will place articles into the relevant subcategory of Category:Articles containing non-English-language text. To suppress this – e.g. when using {{lang}} within a wikilink or the title parameter of a citation – add the parameter |nocat=true.

Parameters

In addition to the three required positional parameters, this template accepts one other positional parameter and several named parameters that are the same as or similar to those supported by {{lang}} and {{lang-??}}.

{{{4}}} – the fourth positional parameter is the translation of <Latin text> and <non-Latin text>
|cat= – takes the value no to inhibit language categorization; inverse of |nocat=yes
|italic1= – italic control for the <Latin text>; see Template:Lang § Parameters for details
|italic2= – italic control for the <non-Latin text>
|label= – label to be used instead of template-provided language label; may be wikilinked; special keyword none causes the template to render without a label
|link= – takes the value no to prevent the language-name label from being linked; |link=no does not unlink wikilinked labels set by |label=
|nocat= – takes the value yes to inhibit language categorization; inverse of |cat=no
|region1= – used to create an IETF language tag for the <Latin text>
|region2= – used to create an IETF language tag for the <non-Latin text>
|script1= – used to create an IETF language tag for the <Latin text>
|script2= – used to create an IETF language tag for the <non-Latin text>
|size1= – specifies font size of the <Latin text>; use a value suitable for use with the CSS font-size property; this should almost always be a relative value supplied in % or em units, not a fixed px value
|size2= – specifies font size of the <non-Latin text>
|variant1= – used to create an IETF language tag for the <Latin text>
|variant2= – used to create an IETF language tag for <non-Latin text>

There are two unique parameters:

|separator= – accepts , (comma; default), ; (semicolon), / (solidus), or a quoted string of text; see §Examples
|swap= – takes the value yes so that the template renders <non-Latin text> first

Examples

The basic form:

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ)}}
Serbo-Croatian: Savez komunista Jugoslavije (SKJ), Савез комуниста Југославије (CKJ)

to invert the rendered order, set |swap=yes

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |swap=yes}}
Serbo-Croatian: Савез комуниста Југославије (CKJ), Savez komunista Jugoslavije (SKJ)

to use a different separator, use |separator=/:

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |separator=/}}
Serbo-Croatian: Savez komunista Jugoslavije (SKJ)/Савез комуниста Југославије (CKJ)

the same but with spaces around the solidus, use |separator=" / ":

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |separator=" / "}}
Serbo-Croatian: Savez komunista Jugoslavije (SKJ) / Савез комуниста Југославије (CKJ)

templates may include quote marks in their output so when using a template in |separator=, make sure that the wrapping quote marks are of the other flavor

{{red|or}} → <span style="color: red;">or</span>

so write:

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |separator=' {{red|or}} '}}
Serbo-Croatian: Savez komunista Jugoslavije (SKJ) or Савез комуниста Југославије (CKJ)

fidget with italics:

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |italic1=no |italic2=yes}}
Serbo-Croatian: Savez komunista Jugoslavije (SKJ), Савез комуниста Југославије (CKJ)

to create IETF language tags for the html:

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |script1=Latn |script2=Cyrl}}
Serbo-Croatian: Savez komunista Jugoslavije (SKJ), Савез комуниста Југославије (CKJ)
[[Serbo-Croatian language|Serbo-Croatian]]: <i lang="sh-Latn">Savez komunista Jugoslavije (SKJ)</i>, <span title="Serbo-Croatian-language text"><span lang="sh-Cyrl">Савез комуниста Југославије (CKJ)</span></span>

to hide the automatic language label, use |label=none:

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |label=none}}
Savez komunista Jugoslavije (SKJ), Савез комуниста Југославије (CKJ)

to use a different label, use |label=:

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |label=[[League of Communists of Yugoslavia]]}}
League of Communists of Yugoslavia: Savez komunista Jugoslavije (SKJ), Савез комуниста Југославије (CKJ)

to unlink the automatic language label, use |link=no:

{{Lang-x2|sh|Savez komunista Jugoslavije (SKJ)|Савез комуниста Југославије (CKJ) |link=no}}
Serbo-Croatian: Savez komunista Jugoslavije (SKJ), Савез комуниста Југославије (CKJ)

to include a translation:

{{lang-x2|sh|Jugoslavenska ratna mornarica|Југословенска ратна морнарица|Yugoslav War Navy}}
Serbo-Croatian: Jugoslavenska ratna mornarica, Југословенска ратна морнарица, lit. 'Yugoslav War Navy'

Error messages

This template calls {{lang}} and the appropriate {{lang-??}} templates. When those templates encounter errors, they will render their own error messages; for assistance, see the help text linked from their error messages.

There are error messages unique to this template. These are:

missing a required argument – one or more of <language tag>, <Latin text>, or <non-Latin text> is missing or empty; all three are required
<text1> is not Latin script – <Latin text> must be Latin-script text
<text2> is Latin script – <non-Latin text> must not be Latin-script text
invalid language code: <language tag>; IETF format not supported – template expects an ISO 639-1, -2, or -3 language code in <language tag>

Tracking categories

  • Category:Lang and lang-xx template errors (55)
  • Category:Lang and lang-xx code promoted to ISO 639-1 (203)
  • Category:Lang and lang-xx using deprecated ISO 639 codes (1)

See also

  • {{Lang-x}}
  • Category:Wikipedia multilingual support templates
  • Lists of ISO 639 codes (language codes)
    • {{ISO 639 name}}
  • List of ISO 15924 codes (script codes)
  • {{cleanup lang}} (for articles which should use this template, but do not yet)
  • {{transliteration}} (for romanization of languages not natively written in the Latin alphabet)
  • {{script}} (for specific characters)
  • {{wikt-lang}} (to simultaneously tag text as a language and link to Wiktionary)
  • {{in lang}} (for visually marking external links to foreign-language content)

References

  1. ^ "Language tags in HTML and XML" at World Wide Web Consortium

External links

  • W3C
    • Language tags in HTML and XML – Overview
    • Authoring HTML: Language declarations – Latest W3C Working Draft
    • Understanding the New Language Tags
    • FAQ: Styling using the lang attribute
  • IANA
    • IANA Language Subtag Registry
    • Tags for Identifying Languages (RFC 4646)
    • Matching of Language Tags (RFC 4647)
    • Language tags (obsolete per RFC 4646)
The above documentation is transcluded from Template:Lang-x2/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Lang-x2&oldid=1123968422"
Last edited on 26 November 2022, at 18:00

Languages

    • Հայերեն
    • नेपाली
    • ပအိုဝ်ႏဘာႏသာႏ
    • Simple English
    • တႆး
    • ไทย
    • Tiếng Việt
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 26 November 2022, at 18:00 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop