Template:Localized link

From Miranda NG
Jump to navigation Jump to search

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

Todo: Improve template to handle case with translatable pages from Category namespace which uses Category_title instead of Page_display_title
Template documentation[view] [edit] [history] [purge]
shortcut: Template:Ll

Purpose

This helper template can be used to link to translatable pages in the user's language. It uses the special page prefix 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 a fallback language where available, or the default wiki language version (English in MediaWiki) if there isn't.

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

Usage

This is the TemplateData documentation for this template used by VisualEditor and other tools.

TemplateData for Localized link

Link to translatable page in the user's language. It uses the special page prefix "Special:MyLanguage/".

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Page name1

no description

Page namerequired
22 Custom label

no description

Default
Display title of linked page in the current page's language
Stringoptional

If 'nsp' parameter is not defined, as link text displays the full pagename (including namespace); otherwise — if 'nsp' parameter is defined by any value — link text displays the short pagename, without namespace.

Examples of simple usage

Use Becomes
{{ll|Communication}} Communication
{{ll|Communication|コミュニケーション}} コミュニケーション
{{ll|Project:About}} Project:AboutProject:About
{{ll|Project:About|nsp=0}} AboutProject:About

Usage in translatable pages

On pages prepared for translation with the Translate extension, this template may be used in three ways.

  1. Inside translation unit (inline with text), in case of custom label, better would be to use standard wikilink syntax and then embed link target into a <tvar|id>...</>.
    As example, instead of {{ll|Communication|About communication}}, better would be [[<tvar|comm>Special:MyLanguage/Communication</>|About communication]].
  2. Outside of translation unit or in some other cases, when you have custom label, better would be to mark for translation only label.
    As example, for some text {{ll|Communication|About communication}} some text , translation markup in translatable page will be:
    <translation>some text</translation> {{ll|Communication|<translation>About communication</translation>}} <translation>some text</translation>.
    This is useful for bulleted lists of links, e.g., in the "See also:" sections.
  3. If link text does not have to be different from the name of landing page, then better would be to embed the whole template call code into <tvar>.
    As example, instead of {{ll|Communication}} better would be <tvar|about-meta>{{ll|Communication}}</>.

Source

Code taken from Mediawiki - Template:Localized_link

See also