shortcuts: {{ll}} {{LL}}

Template:Localized link

From Linux Web Expert


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

Template documentation

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

[<span style="" title="<translate nowrap> View this template</translate>"><translate> view</translate> · <span style="" title="<translate nowrap> Discuss this template</translate>"><translate> talk</translate> · <span style="" title="<translate nowrap> Edit this template</translate>"><translate> edit</translate>]

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

Localized link

<templatedata> { "description": { "be-tarask": "Спасылка на перакладную старонку мовай удзельніка. Яна мае адмысловую прыстаўку назвы «Special:MyLanguage/».", "en": "Link to translatable page in the user’s language. It uses the special page prefix “Special:MyLanguage/”.", "cs": "Odkaz na stránku, kterou lze přeložit v jazyce uživatele. Používá speciální předponu stránky “Special:MyLanguage/”.", "fr": "Lien vers une page traduisible dans la langue de l’utilisateur. Le lien utilise la page spéciale «Special:MyLanguage/».", "tr": "Kullanıcının dilindeki çevrilebilir sayfaya bağlantı. “Special:MyLanguage/” özel sayfa önekini kullanır.", "sv": "Länk till översättbar sida på användarens språk. Den använder specialsideprefixet “Special:MyLanguage/”." }, "format": "inline", "params": { "1": { "label": { "be-tarask": "Назва старонкі", "en": "Page name", "cs": "Název stránky", "fr": "Nom de la page", "es": "Nombre de la página", "tr": "Sayfa adı", "sv": "Sidnamn" }, "description": { "be-tarask": "Зьвязаная старонка", "en": "Linked page", "cs": "Odkazovaná stránka", "fr": "Page liée", "tr": "Bağlantılı sayfa", "sv": "Länkad sida" }, "required": true, "suggested": true, "type": "wiki-page-name" }, "2": { "label": { "be-tarask": "Тэкст для вываду", "en": "Displayed text", "cs": "Zobrazený text", "fr": "Texte affiché", "tr": "Görüntülenen metin", "sv": "Visad text" }, "description": { "be-tarask": "Паказаць у спасылцы гэты тэкст", "en": "Display text for this link", "cs": "Zobrazí text pro tento odkaz", "fr": "Texte affiché pour ce lien", "tr": "Bu bağlantı için metni görüntüleyin", "sv": "Visad text för denna länk" }, "suggested": true, "type": "line" }, "nsp": { "label": { "en": "Display the namespace", "cs": "Zobrazit jmenný prostor", "tr": "Ad alanını görüntüleyin", "sv": "Visa namnrymden", "fr": "Affichage de l'espace de noms" }, "description": { "be-tarask": "Калі парамэтар «nsp» не зададзены, у тэксьце спасылкі выведзецца поўная назва старонкі (з прасторай); інакш кажучы — калі парамэтар «nsp» мае якое-кольвек значэньне, то ў тэксьце спасылкі будзе кароткая назва без прасторы.", "en": "If the “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.", "cs": "Pokud není parametr “nsp” definován, protože text odkazu zobrazuje celý název stránky (včetně jmenného prostoru); jinak - pokud je parametr “nsp” definován jakoukoli hodnotou - text odkazu zobrazuje krátký název stránky bez jmenného prostoru.", "tr": "Bağlantı metni tam sayfa adını gösterdiğinden (ad alanı dahil) “nsp” parametresi tanımlanmamışsa; aksi takdirde, “nsp” parametresi herhangi bir değerle tanımlanmışsa, bağlantı metni, ad alanı olmadan kısa sayfa adını görüntüler.", "sv": "Om parametern “nsp” inte angetts, visas hela sidnamnet som länktext (med namnrymd); annars — om parametern “nsp” angetts med något värde — visar länktexten det korta sidnamnet, utan namnrymd.", "fr": "Si le paramètre “nsp” n'est pas défini, le texte du lien affiche le nom complet de la page (AVEC la valeur de l'espace de noms); sinon — si le paramètre “nsp” est défini avec une valeur quelconque — le texte du lien affiche le nom court de la page, SANS l'espace de noms." }, "autovalue": "0", "type": "string" } } } </templatedata>

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

Examples of simple usage

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

Usage in translatable pages

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

  1. Substitute this template, then embed the wikilink target in a <tvar name=id>...</tvar>, separate from the translatable text of the link.
    For example, instead of {{ll|Communication|About communication}}, the translation markup in the translatable page will be [[<tvar name=1>Special:MyLanguage/Communication</tvar>|About communication]].
  2. Alternatively, exclude this code from the translatable section.
    For example, for some text {{ll|Communication|About communication}} some text, the translation markup in the 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.
  3. If link text is the same as the name of the target page, all of the code could also be embedded into ‎<tvar>.
    For example, instead of {{ll|Communication}}, the wikicode in the translatable page will be <tvar name=1>{{ll|Communication}}</tvar>.

See also