Template:In lang/doc

From Black Cat Studios
Jump to navigationJump to search

Template:In lang is used to denote that a text source is written in a specific language.

For citations using a citation template ({{cite web}}, {{cite news}}, {{cite journal}}, etc.), that template's |language= parameter should be used instead.

To note a span of text in a different language, {{lang}} or one of the {{lang-x}} templates ({{lang-fr}}, {{lang-ast}}, etc.) should be used instead.

Usage

Typical use of this template is inside <ref>...</ref> tags where the reference is not templated and the referenced source is non-English:

<ref>[https://www.example.com "Non English Journal Article"]. ''Non-English Journal''. '''12'''(3): 231–241 {{in lang|xx}}</ref>

Also finds use in External links sections to mark non-English link-targets:

[https://www.example.com Non English external link] {{in lang|xx}}

This template does not markup non-English text. For that, use {{lang}} or an appropriate {{lang-??}} template.

Parameters

This template accepts one or more positional language-tag parameters (<tag>) and two named parameters:

  • {{In lang|<tag>|<tag2>|...|link=|cap=}}

Most common use is a single language:

  • {{In lang|de}}(in German)

The positional parameters

  • <tag> – required; <tag> is a valid ISO-639 language tag or a valid IETF language tag; more than one language tag supported:
    • {{In lang|cs|en|de|fr|es|ca-valencia|pl|ru|ja|zh}}
      • (in Czech, English, German, French, Spanish, Valencian, Polish, Russian, Japanese, and Chinese)

The named parameters are:

  • link – accepts the single value yes; creates link to language article


Usage

Wraps a short span of text in <syntaxhighlight> tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre> or <syntaxhighlight>...</syntaxhighlight>. See Help:Wiki markup for an explanation of what the various tags do.

If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}.

The template uses the <syntaxhighlight> tag with the attribute inline=1. This works like the combination of the <code> and <nowiki> tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}} will not render the word "wiki" in bold, and will render the tripled-single-quotes:

Template loop detected: Template:Code

However, {{code|a {{template}} call}} will still invoke the template:

Template loop detected: Template:Code

Use <nowiki>...</nowiki> around the template name to avoid this problem:

Template loop detected: Template:Code

When used inline with regular text, {{code}} generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:

Template loop detected: Template:Code

is well spaced:

foo  Template loop detected: Template:Code  quux.

versus:

Template loop detected: Template:Code

which is going to be visually confusing for many:

foo Template loop detected: Template:Code quux.

because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font.

Use parameter {{{2}}} (unnamed, as |2=, or more explicitly as |lang=) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.

This template does not need to be substituted.

Examples

Markup Renders asScript error: No such module "For loop".

Included templates

Embedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use <code>...</code> as a wrapper instead of this template.

Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:

Markup Renders asScript error: No such module "For loop".

The above example shows the HTML rendered by the citation template, including the hidden metadata.

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.

TemplateData for In lang

Script error: No such module "Format TemplateData".

See also

(in Navajo)
  • cap – accepts the single value yes; capitalizes the first letter of "In":
    • {{In lang|pt-BR|cap=yes}}(In Brazilian Portuguese)

Error messages

This template has one error message of its own:

error: {{In lang}} missing language tag – displayed when the template is transcluded without an ISO 639 language tag or IETF language tag.

All other error messages related to the use of this template are emitted by Module:Lang and are documented at Category:Lang and lang-xx template errors.

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.

TemplateData for In lang

Produces the phrase "(in LANGUAGE)" with language codes.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
11

no description

Unknownoptional
22

no description

Unknownoptional
33

no description

Unknownoptional
44

no description

Unknownoptional

Categories

Transclusions in mainspace articles will add the article to the appropriate subcategory of Category:Articles with non-English-language sources. There are two forms of these subcategories:

Category:Articles with <language name>-language sources (<tag>) – for individual languages[1] and for macrolanguages[2]
Category:Articles with sources in <collective name> languages (<tag>) – for language collectives[3]

where <language name> and <collective name> is the name used in the template's rendering and <tag> is the ISO 639 tag or IETF language tag.

References

  1. "ISO 639-3: Scope of denotation for language identifiers: Individual languages". SIL International. Retrieved 5 December 2019.
  2. "ISO 639-3: Scope of denotation for language identifiers: Macrolanguages". SIL International. Retrieved 5 December 2019.
  3. "ISO 639-3: Scope of denotation for language identifiers: Collections of languages". SIL International. Retrieved 5 December 2019.