Template:LocalizedLink

From translatewiki.net
Jump to navigation Jump to search

Test Template Info-Icon - Version (2).svg

The documentation of this template is included from its /doc subpage (Edit)

Retrieves the name of a localized page, using the base page name given in parameter 1. Such localizable base page has subpages named with the language code.

The returned value is a link containing the localized full page name even if it is dislpayed with a default text according to the language used in the source page where this template is used.

If no localized page exists for that template in the tested language, then the full name of the base target page will be returned (if it exists too).

If the base target name does not even exist, the full page name of Template:Localized/Missing will be returned to signal the invalid or missing parameter 1 that should be a valid page name without the namespace prefix (that must be passed separately if this is not "Template"), or that the target namespace to test was incorrectly set in the parameters.

Usage:
  • {{LocalizedLink|
ns=namespace|
1=base target page name|
lang=uilangcode|
2=text|
}}
Parameters:
  • ns= (optional) alternate target namespace to test (the default namespace is the main anonymous namespace)
  • 1= (mandatory) base target page name (without any namespace prefix, and without any language code subpage)
  • 2= (optional) the text of the link to display on the source page (default value is the combination of the target namespace and of the base target page name)
  • lang= (optional) language code to test (the default code used is the language code taken from a localized subpage where this template is inserted, otherwise the default is {{UILANGCOE}} on non localized pages)
Example:
  • {{LocalizedLink|
ns=Project|
1=Translator|
2=Permission requests}} generates:

Permission requests

  • {{LocalizedLink|
Main Page
}} generates:

Main Page

See also: