Analysis of the code
The code
{{#ifexist:
{{#if: {{{2|}}}
| {{{2}}}
| {{#if: {{NAMESPACE}} | {{NAMESPACE}}:}} {{BASEPAGENAME}} }}/{{{1}}}
| • <span lang="{{{1}}}">
{{#if: {{{2|}}}
| {{#if:{{{3|}}}
| {{#ifexist:
{{{1}}}:{{{3}}}
| [[ {{{1}}}:{{{3}}} | {{#language:{{{1}}} }} ]]
| [[ {{{2}}}/{{{1}}} | {{#language:{{{1}}} }} ]]
}}
| [[ {{{2}}}/{{{1}}} | {{#language:{{{1}}} }} ]]
}}
| [[ :{{NAMESPACE}}:{{BASEPAGENAME}}/{{{1}}} | {{#language:{{{1}}} }} ]]
}} </span>
| <span></span>
}}
Interpretation
IF the following page exists:
IF there is a 2nd parameter
THEN
{{{2}}}
ELSE
IF {{NAMESPACE}} is not the Main space
THEN {{NAMESPACE}}:
{{BASEPAGENAME}}
THEN
Produce • and a span: <span lang="{{{1}}}">
IF there is a 2nd parameter
THEN
IF there is a 3rd parameter
THEN
IF the page exists: {{{1}}}:{{{3}}}
THEN [[ {{{1}}}:{{{3}}} | {{#language:{{{1}}} }} ]]
ELSE [[ {{{2}}}/{{{1}}} | {{#language:{{{1}}} }} ]]
ELSE
[[ {{{2}}}/{{{1}}} | {{#language:{{{1}}} }} ]]
ELSE
[[ :{{NAMESPACE}}:{{BASEPAGENAME}}/{{{1}}} | {{#language:{{{1}}} }} ]]
Close span: </span>
ELSE
Produce an empty span: <span></span>
What it does
Parameters:
- The country code (CC)
- (optional) An alternative page name (AN)
- (optional) A translated alternative page name (TAN)
Checks if a country-specific page exists
- By default (NAMESPACE:)BASENAME/CC, so based on the page where the template is called. (NAMESPACE is only added if it is not the Main (i.e. empty) namespace.)
- Example: My great page/nl
- Example: User:Me/My great page/fr
- If AN is given, then test for the existence of a page called AN
If a country-specific page exists, then construct an entry for the table that is built by Template:Languages
- start with a bullet: " • "
- Open a span, with an anchor 'lang':
<span lang="CC"> - Create a link to the country-specific page
- By default
[[ :{{NAMESPACE}}:{{BASEPAGENAME}}/CC | {{#language:CC }} ]]
- Example:
[[::My great page/nl | Nederlands ]] - Example:
[[:User:Me/My great page/fr| Français ]]
- If an AN but no TAN was given,
- then
[[AN/CC | {{#language:CC }} ]] - Example:
[[Alternative name/nl | Nederlands ]] - Example:
[[Alternative name/fr | Français ]]
- If an AN and a TAN was given,
- and page CC:TAN exists,
- then
[[CC:TAN | {{#language:CC }} ]] - Example:
[[nl:Alternatieve naam | Nederlands ]] - Example:
[[fr:Nom alternative | Français ]]
- but page CC:TAN does not exist,
- then fall back to
[[AN/CC | {{#language:CC }} ]]
- By default
- Close the span:
</span>
If the page given by the parameters does not exist, then issue an empty span: <span></span>
Note: {{#language:CC}} Converts the country code into the name for that CC's language, written in that language. So 'en' becomes 'English', 'nl' becomes 'Nederlands', 'fr' becomes 'Français', etcetera.
--DomoViridi (talk) 08:54, 8 March 2026 (UTC)