Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Lang: Difference between revisions

Template page
No edit summary
 
use empty value if lang isn't passed, to avoid Category:Pages with invalid language codes be shown in this template
 
(11 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<includeonly><span lang="{{{1}}}" xml:lang="{{{1}}}">-{{{{2}}}}-</span></includeonly>
<div lang="{{{1|}}}" dir="{{#dir:{{{1|}}}}}" class="description {{{1|}}}" style="display:inline;">{{{2}}}</div><noinclude>
{{Documentation}}
 
[[Category:Internationalization templates]]
</noinclude>

Latest revision as of 06:51, 20 August 2024

{{{2}}}
Template documentation[ view · edit · history · purge ]
This documentation is transcluded from Template:Lang/doc.

This template is for example called from autotranslatable templates and is used to apply the "lang" and "dir" attributes to the span tag containing the text. It also adds CSS classes, that for example allow CSS highlighting text that is in a specific language.

Usage

{{Lang |1= |2= }}

This template tags the wrapped text with the "description" CSS class, which will cause Media Viewer to display that text. In a file context, the template should therefore only be used to wrap text that is useful as a file description. Do not use this as a general-purpose language tagging template; most of the time it is sufficient to directly add the necessary HTML attributes instead (example), with wikitext like <div lang="{{#bcp47:LANG}}" dir="{{#dir:LANG}}">TEXT</div>.

Template parameters

ParameterDescriptionDefaultStatus
1language codeLanguage code. For a list of language codes to use for parameter 1 see w:List of ISO 639-1 codes.emptyrequired
2textemptyrequired
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

This template is for example called from autotranslatable templates and is used to apply the "lang" and "dir" attributes to the span tag containing the text. It also adds CSS classes, that for example allow CSS highlighting text that is in a specific language.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
language code1

Language code. For a list of language codes to use for parameter 1 see "List of ISO 639-1 codes" on the English Wikipedia.

Linerequired
text2

Stringrequired

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

See also

  • {{multilingual link}}
  • {{LangS}} — variant to use in running text ("inline")

Localization

This template is not intended to be localized.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.