Template:Localized link: Difference between revisions
No edit summary |
(Update to make LL highlight current links in bold. This should work for all languages.) |
||
Line 1: | Line 1: | ||
{{#ifeq:{{ | {{#ifeq:{{BASEPAGENAME:{{{1}}}}}|{{BASEPAGENAME}}<!--self link (including translation pages)--> | ||
|<b> | |<b> | ||
}}[[Special:MyLanguage/{{{1}}}|{{#if:{{{2|}}}|{{{2}}}|{{{2|{{#ifexist:Translations:{{#if:{{NAMESPACE:{{{1}}}}}|{{NAMESPACE:{{{1}}}}}:}}{{PAGENAME:{{{1}}}}}/Page display title/{{PAGELANGUAGE}}<!--if the source page, PAGELANGUAGE returns en--> | }}[[Special:MyLanguage/{{{1}}}|{{#if:{{{2|}}}|{{{2}}}|{{{2|{{#ifexist:Translations:{{#if:{{NAMESPACE:{{{1}}}}}|{{NAMESPACE:{{{1}}}}}:}}{{PAGENAME:{{{1}}}}}/Page display title/{{PAGELANGUAGE}}<!--if the source page, PAGELANGUAGE returns en--> | ||
Line 11: | Line 11: | ||
|{{{1}}} | |{{{1}}} | ||
}} | }} | ||
}}}}}}}]]{{#ifeq:{{ | }}}}}}}]]{{#ifeq:{{BASEPAGENAME:{{{1}}}}}|{{BASEPAGENAME}}<!--self link (including translation pages)--> | ||
|</b> | |</b> | ||
}}<span style="display:none">[[:{{{1}}}| ]]</span><noinclude>{{Documentation}}</noinclude> | }}<span style="display:none">[[:{{{1}}}| ]]</span><noinclude>{{Documentation}}</noinclude> |
Latest revision as of 18:33, 27 March 2024
[[Special:MyLanguage/{{{1}}}|{{{1}}}]]
Taken from MediaWiki.
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 on this wiki) 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
Auto-translatable version
{{ll|target page}}
Version with custom display text
{{ll|target page|display text}}
Usage in translatable pages
On pages prepared for translation, this template may be used in three ways.
- Substitute this template, and then use a wikilink target embedded in a
<tvar name=id>...</tvar>
, separate from the translatable displayed text of the link.- For example, instead of
{{ll|Communication|About communication}}
, translation markup in translatable page will be[[<tvar name=1>Special:MyLanguage/Communication</tvar>|About communication]]
.
- For example, instead of
- Alternatively, you may exclude this code from translatable section.
- As an example, for
some text {{ll|Communication|About communication}} some text
, translation markup in translatable page will be: <translate>some text</translate> {{ll|Communication|2=<translate>About communication</translate>}} <translate>some text</translate>
- This is useful for bulleted lists of links, e.g. in the "See also:" sections.
- As an example, for
- If the link text does not have to be different from the name of landing page, it is better to embed all this code into
<tvar>
tags.- As an example, instead of
{{ll|Communication}}
, translation markup in translatable page will be<tvar name=1>{{ll|Communication}}</tvar>
.
- As an example, instead of
Details
This template has three parameters.
- Target page (
1
). This is required. This is the page that the link should target. - Display text (
2
). This is suggested, but not required. This is the text that should be displayed for the link. - Namespace display (
nsp
). This is optional. 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.