Difference between revisions of "Template:LocalizedLink"

From Online Manual

Jump to: navigation, search
(Created page with "<includeonly>[[<!-- -->{{#if:<!-- -->{{#if:{{{lang|}}}|<!-- -->{{#ifexist:{{#if:{{{ns|}}}|{{{ns|}}}:}}:{{{1}}}/{{{lang|}}}|<!-- -->1<!-- -->}}<!-- -->}...")
 
(Undo revision 25590 by Illori (talk))
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>[[<!--
+
{{#if: {{{1|}}}
-->{{#if:<!--
+
|<!--
  -->{{#if:{{{lang|}}}|<!--
+
-->[[{{{1}}}<!--                                               target page name (required)
      -->{{#ifexist:{{#if:{{{ns|}}}|{{{ns|}}}:}}:{{{1}}}/{{{lang|}}}|<!--
+
  -->{{#ifexist:{{{1}}}/{{SUBPAGENAME}}|/{{SUBPAGENAME}}}}<!-- current subpage (if it exists)
        -->1<!--
+
  -->#{{{anchor|}}}<!--                                       optional anchor (if specified)
      -->}}<!--
+
-->|{{#if:{{{text|}}}|{{{text|}}}|{{{1}}}}}<!--                     visible translation or pagename
  -->}}<!--
+
-->]]<!--
-->|{{#if:{{{ns|}}}|{{{ns|}}}:}}{{{1}}}/{{{lang|}}}<!--
+
-->{{#ifexist:{{{1}}}/{{SUBPAGENAME}}||<!--     if subpage does not exist
-->|<!--
+
  -->{{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}||<!-- and it is on a subpage
  THE LANGUAGE CODE OF THE CURRENT PAGE SHOULD ALWAYS BE TESTED FIRST!
+
    -->&nbsp;<small dir="ltr">(en)</small>}}<!-- then add "(en)"
  -->{{#if:<!--
+
-->}}
      -->{{#ifeq:{{BASEPAGENAME}}/{{SUBPAGENAME}}|{{PAGENAME}}|<!--
+
|{{#if: {{{anchor|}}}
        -->{{#ifexist:{{#if:{{{ns|}}}|{{{ns|}}}:}}{{{1}}}/{{SUBPAGENAME}}|<!--
+
  |{{#if:{{{text|}}}
            -->1<!--
+
    |[[#{{{anchor}}}|{{{text|}}}]]
        -->}}<!--
+
    |[[#{{{anchor}}}]]}}
      -->}}<!--
+
  |Invalid link
      Use the existing subpage with the same language code:
+
  }}
  -->|{{#if:{{{ns|}}}|{{{ns|}}}:}}{{{1}}}/{{SUBPAGENAME}}<!--
+
}}<noinclude>[[Category:Localisation templates|{{PAGENAME}}]]</noinclude>
  -->|<!--
 
      NOTE THAT THE {{UILANGCODE}} HAS CAVEATS WITH MEDIAWIKI CACHE. IT SHOULD BE TESTED ONLY AFTER THE PREVIOUS ONE!
 
      -->{{#ifexist:{{#if:{{{ns|}}}|{{{ns|}}}:}}{{{1}}}/{{UILANGCODE}}<!--
 
          Use the existing subpage with the default {{UILANGCODE}}
 
      -->|{{#if:{{{ns|}}}|{{{ns|}}}:}}{{{1}}}/{{UILANGCODE}}<!--
 
      -->|<!--
 
        DEFAULT IS THE UNTRANSLATED PAGE
 
        -->{{#if:{{{ns|}}}|{{{ns|}}}:}}{{{1}}}<!--
 
      -->}}<!--
 
  -->}}<!--
 
-->}}|{{#if:{{{2|}}}|{{{2|}}}|{{{1}}}}}]]</includeonly><noinclude>{{doc}}</noinclude>
 

Latest revision as of 11:34, 8 July 2014

Invalid link