Jump to content

Template:Langx

From Wikipedia, the free encyclopedia
Template documentation[view] [edit] [history] [purge]
This template is used on approximately 653,000 pages, or roughly 1% of all pages.
To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
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 should not be substituted.
After a discussion in 2024, most of the {{lang-??}} templates were replaced by {{langx}}.
This template uses Lua:
Language templates
Language names (ISO 639)
Interwiki links
Foreign-language text
Other

This language template identifies non-English text. It is very similar to {{lang}} but inserts the name of the language as a label. The text is formatted according to recommendations in Wikipedia:Manual of Style/Text formatting SS Foreign terms: italics for languages that use the Latin alphabet, normal for others.

Usage

An IETF language tag and the non-English term or phrase are the only required parameters.

The template should generally be placed after the English translation of the foreign term or phrase.

  • The parameter |links=no prevents the language name from being linked.
  • The parameter |translit= allows for a romanization. This parameter is not supported by {{langx|<tag>|...}} templates for languages that are already written in Latin script.
  • The parameter |lit= enables a literal translation (in English) to be given.

Parameters

Langx supported parameters
Parameter Definition Yields to Alias
|1= The IETF language tag for the content in |text= -- |code=
|text= The non-English text -- |2=
|translit= The Latin script transliteration of the content in |text= -- |3=
|translit-std= The standard used for the transliteration of the value of |translit=; accepted values are: Abkai, ahl, ALA, ALA-LC, batr, bgn/pcgn, DIN, eae, hepburn, hu, hunterian, IAST, ISO, jyutping, mdorff, mlcts, mr, nihon-shiki, no_std, pinyin, rr, rtgs, satts, scientific, ukrainian, ungegn, wadegile, wehr, yaleko --
|translit-script= The transliteration standard's script identifier --
|translation= The literal English translation or gloss of the content in |text=. Will be surrounded in single-quotes. The text will be tagged with CSS class gloss-text and the quotes with gloss-quot, like how {{gloss}} does it, enabling customization in user stylesheets. -- |lit=, |4=
|label= The label to be used instead of template-provided language label. May be wikilinked. Special keyword none causes the template to render without any labels (including transliteration and translation labels) --
|link= Links language name and static text associated with |translit= and |translation=. Defaults to yes. Accepted values are: no, yes; |link=no does not unlink wikilinked labels set by |label= -- |links=
|proto= Accepted values are: no (default) or yes (default for private-use language tags with the -x-proto subtags); when yes (default or explicit), prefixes rendered text with an asterisk indicating 'unattested' --
|script= (Deprecated - include script subtag in |1=) IETF language script subtag; sometimes set by the template when the language of the content in |text= uses more than one writing system; always four alpha characters; a value of Latn (not "Latin"!) forces italic rendering unless overridden by |italic=; overrides |rtl= |italic=
|region= (Deprecated - include region subtag in |1=) IETF language region subtag --
|variant= (Deprecated - include variant subtag in |1=) IETF language variant subtag --
|rtl= yes indicates that the writing system used for the content in |text= is right-to-left; accepted values are: no (default), yes |script=
|italic= see table "Langx |italic= parameter operation"; accepted values are: yes, no, unset, invert, default -- |italics=, |i=
|size= Specifies font size of the content in |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. --
|engvar= Selects English variant spelling of 'romanised' or 'romanized' (default) according to the country specified; accepted values are: au (Australia), ca (Canada), gb (Great Britain), ie (Ireland), in (India), nz (New Zealand), us (United States), za (South Africa) --
|cat= Inhibits automatic categorization; mirror version of |nocat=; accepted values are: no, n, false, f, off, 0 --
|nocat= Inhibits automatic categorization; mirror version of |cat=; accepted values are: yes, y, true, t, on, 1 --
Langx |italic= parameter operation
|italic= value Description Example code Result HTML markup
  • parameter not present;
  • parameter present, not set;
  • invalid value
  • module applies style from:
  • template setting, or
  • -latn script subtag;
  • else inherits from external markup;
  • invalid values treated as default
{{Langx|ru|tundra}} Russian: tundra [[Russian language|Russian]]: <span lang="ru">tundraspan>
{{Langx|ru|tundra}} Russian: tundra [[Russian language|Russian]]: <i lang="ru">tundrai>
Incorrect markup; this requires script subtag -latn.
{{Langx|fr|toundra}} French: toundra [[French language|French]]: <i lang="fr">toundrai>
{{Langx|ru-latn|tundra}} Russian: tundra [[Russian language|Russian]]: <i lang="ru-Latn">tundrai>
default {{Langx|ru|tundra|italic=default}} Russian: tundra [[Russian language|Russian]]: <span lang="ru">tundraspan>
{{Langx|fr|toundra|italic=default}} French: toundra [[French language|French]]: <i lang="fr">toundrai>
{{Langx|ru-latn|tundra|italic=default}} Russian: tundra [[Russian language|Russian]]: <i lang="ru-Latn">tundrai>
no
  • module applies upright style;
  • overrides -latn script subtag;
  • overrides external markup
{{Langx|ru|tundra|italic=no}} Russian: tundra [[Russian language|Russian]]: <span lang="ru" style="font-style: normal;">tundraspan>
{{Langx|fr|toundra|italic=no}} French: toundra [[French language|French]]: <span lang="fr" style="font-style: normal;">toundraspan>
{{Langx|ru-latn|tundra|italic=no}} Russian: tundra [[Russian language|Russian]]: <span lang="ru-Latn" style="font-style: normal;">tundraspan>
''{{Langx|ru-latn|tundra|italic=no}}'' Russian: tundra ''[[Russian language|Russian]]: <span lang="ru-Latn" style="font-style: normal;">tundraspan>''
yes
  • module applies italic style;
  • ignores -latn script subtag
{{Langx|ru|tundra|italic=yes}} Russian: tundra [[Russian language|Russian]]: <i lang="ru">tundrai>
{{Langx|ru-latn|tundra|italic=yes}} Russian: tundra [[Russian language|Russian]]: <i lang="ru-Latn">tundrai>
unset
  • module applies no style;
  • inherits style from external markup;
  • overrides -latn script subtag
{{Langx|ru|tundra|italic=unset}} Russian: tundra [[Russian language|Russian]]: <span lang="ru">tundraspan>
''{{Langx|ru|tundra|italic=unset}}'' Russian: tundra ''[[Russian language|Russian]]: <span lang="ru">tundraspan>''
{{Langx|ru-latn|tundra|italic=unset}} Russian: tundra [[Russian language|Russian]]: <span lang="ru-Latn">tundraspan>
''{{Langx|ru-latn|tundra|italic=unset}}'' Russian: tundra ''[[Russian language|Russian]]: <span lang="ru-Latn">tundraspan>''
invert
  • module applies no style;
  • inverts style in internal markup;[a]
  • disables auto-italics
  • overrides -latn script subtag
{{Langx|ru|tundra|italic=invert}} Russian: tundra [[Russian language|Russian]]: <span lang="ru">''tundra''span>
{{Langx|ru|''tundra''|italic=invert}} Russian: tundra [[Russian language|Russian]]: <span lang="ru">tundraspan>
{{Langx|ru-latn|tundra|italic=invert}} Russian: tundra [[Russian language|Russian]]: <span lang="ru-Latn">''tundra''span>
{{Langx|ru-latn|''tundra''|italic=invert}} Russian: tundra [[Russian language|Russian]]: <span lang="ru-Latn">tundraspan>

Notes

  1. ^ compare |italic=invert to |italic=unset:
    {{Langx|de|... ein neues Opernprojekt in Angriff: ''Das Kathchen von Heilbronn'', nach Heinrich von Kleists gleichnamigem Drama.|italic=invert}}
    German: ... ein neues Opernprojekt in Angriff: Das Kathchen von Heilbronn, nach Heinrich von Kleists gleichnamigem Drama.
    {{Langx|de|''... ein neues Opernprojekt in Angriff: ''Das Kathchen von Heilbronn'', nach Heinrich von Kleists gleichnamigem Drama.''|italic=unset}}
    German: ... ein neues Opernprojekt in Angriff: Das Kathchen von Heilbronn, nach Heinrich von Kleists gleichnamigem Drama.

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Langx in articles based on its TemplateData.

TemplateData for Langx

Indicates to readers the original form of a term or phrase in a foreign language.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Language tag1

A valid IETF language tag identifying the language of the non-English text.

Example
ja
Stringrequired
Text2

The non-English text to display.

Example
Dong Jing Du
Stringrequired
Transliteration3 translit

The transliteration of the foreign text, for languages that do not use the Latin alphabet. This field is ignored for languages that do use the Latin alphabet.

Example
Tokyo
Stringoptional
Literal translation4 lit translation

The literal translation of the foreign text.

Example
eastern capital
Stringoptional
Display linklinks link

Set to 'no' to disable the link to the article's language.

Default
yes
Auto value
no
Booleanoptional
Language labellabel

If 'none', suppresses language link and label. Other options may be available depending on the language.

Example
none
Lineoptional
Right-to-leftrtl

Toggle right-to-left view for the foreign text.

Default
no
Example
yes
Booleanoptional
Italicizeitalic italics i

Toggle italicization for the foreign text.

Default
yes
Example
no
Booleanoptional
Font-sizesize

Sets font-size for the foreign text.

Example
120%, 1.2em
Unknownoptional
English variantengvar

Spelling of 'romanized/romanised'.

Suggested values
au ca gb ie in nz us za
Stringoptional

Examples

The following examples show translations from German or French.

  • Weimar is located in the federal state of Thuringia ({{Langx|de|Thuringen}}).
    Weimar is located in the federal state of Thuringia (German: Thuringen).
  • The ''Seafarers of Catan'' ({{Langx|de|Die Seefahrer von Catan}}) is an expansion of the board game ''[[The Settlers of Catan]]''.
    The Seafarers of Catan (German: Die Seefahrer von Catan) is an expansion of the board game The Settlers of Catan.
  • Albert the Bear ({{Langx|de|Albrecht der Bar|links=no}})
    Albert the Bear (German: Albrecht der Bar)
  • ''All Quiet on the Western Front'' ({{Langx|de|Im Westen nichts Neues|lit=In the West Nothing New}}) is a novel by [[Erich Maria Remarque]].
    All Quiet on the Western Front (German: Im Westen nichts Neues, lit. 'In the West Nothing New') is a novel by Erich Maria Remarque.
  • '''Paris Cite University''' ({{langx|fr|links=no|'''Universite Paris Cite'''}}) is a public research university
    Paris Cite University (French: Universite Paris Cite) is a public research university

Comparison with the Lang template

This template differs from the {{lang}} template in that this one labels the text with the name of the language. For that reason, to avoid unnecessary clutter, this template should be used sparingly, in cases where the name of the language should be made explicit, such as the first place in an article that the translation of a word or phrase in English is given, or when renderings in multiple languages are being given and confusion is possible in the absence of such labeling.

Comparison:

  • {{Lang|ru|tundra}} produces tundra
  • {{Langx|ru|tundra}} produces Russian: tundra
  • {{Langx|ru|tundra|label=none}} produces tundra

Tracking categories

TODO: (2024-09-22) rename these categories

See also

The above documentation is transcluded from Template:Langx/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.