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:Localized link/sandbox: Difference between revisions

Template page
Use {{TranslatableMW}}
Replace red-link {{pagelang2}} with {{int:lang}} in sandbox (D)
 
Line 8: Line 8:
     |{{PAGENAME:{{{1}}}}}
     |{{PAGENAME:{{{1}}}}}
   }}
   }}
|{{#ifexist:Translations:{{#if:{{NAMESPACE:{{{1}}}}}|{{NAMESPACE:{{{1}}}}}:}}{{PAGENAME:{{{1}}}}}/Page display title/{{pagelang2}}<!--if the source page, pagelang2 returns en-->
|{{#ifexist:Translations:{{#if:{{NAMESPACE:{{{1}}}}}|{{NAMESPACE:{{{1}}}}}:}}{{PAGENAME:{{{1}}}}}/Page display title/{{int:lang}}<!--if the source page, pagelang2 returns en-->
   |{{#if:{{{nsp|}}}
   |{{#if:{{{nsp|}}}
     |{{PAGENAME:{{ {{TNTN|Translations:{{#if:{{NAMESPACE:{{{1}}}}}|{{NAMESPACE:{{{1}}}}}:}}{{PAGENAME:{{{1}}}}}/Page_display_title}} }} }}
     |{{PAGENAME:{{ {{TNTN|Translations:{{#if:{{NAMESPACE:{{{1}}}}}|{{NAMESPACE:{{{1}}}}}:}}{{PAGENAME:{{{1}}}}}/Page_display_title}} }} }}

Latest revision as of 04:56, 11 August 2026

[[:Special:MyLanguage/{{{1}}}|{{{1}}}]]

Template documentation[ view · edit · history · purge ]
This documentation is transcluded from Template:Localized link/doc.

This template can be used to link to translatable pages in the user’s language. It uses the special page Special:MyLanguage, which checks if there is a translated version of a page in the user’s language, and links to it if there is one, and links to the English version if there isn’t.

It may be used in translated pages, so that they link to the right page even if there is no translated page in that language.

Usage

{{Localized link |1= |2= }}

Template parameters

<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

No description.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Page name1

Linked page name.

Page namerequired
Display text2

Displayed link text.

Default
{{Translations:{{{1}}}/Page_display_title/{{PAGELANGUAGE}}}}
Linesuggested
Interwiki prefixiw

The Interwiki prefix. See [[Special:Interwiki]] for a list of valid values. Note that the target wiki must use MediaWiki-style page names and support “Special:MyLanguage”.

Stringoptional
Show namespace prefix?nsp

Whether to include the namespace prefix, ignored if parameter 2 is passed.

Default
1
Auto value
0
Booleanoptional
Edit parameter translations

Additional information

The template is intended to be used in the following namespaces: no namespace specified

The template is intended to be used by the following user groups: no user group specified

Example

{{Localized link|Commons:Welcome}}<br>{{Localized link|Commons:Welcome|关于}}

renders as:

See also

  • {{Pg}} More suitable for Commons help pages. Similar functionality, but on non-English pages attempts to link first to a version of the target page in the current page language, then in the user’s preferred language, then in English as a last resort.
  • Template:Localized link/messagedoc – should be used for message documentation in translatable pages that use this template.
  • {{Multilingual link}} Links to Wikipedia article in user's interface language.

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.