Template:Flag: Difference between revisions

From eMushpedia
Jump to navigation Jump to search
Created page with "<includeonly><onlyinclude>[[File:{{lc:Icon-flag-{{{1}}}}}.png|16px|link=|alt={{{1}}}]]</onlyinclude></includeonly> <noinclude><templatedata> { "description": "Displays a flag icon based on a language code (fr, en, es).", "params": { "1": { "label": "Language code", "description": "Language code to display the corresponding flag (e.g. fr, en, es).", "type": "string", "required": true, "example": "..."
 
No edit summary
 
Line 1: Line 1:
<includeonly><onlyinclude>[[File:{{lc:Icon-flag-{{{1}}}}}.png|16px|link=|alt={{{1}}}]]</onlyinclude></includeonly>
<includeonly><onlyinclude>
[[File:{{lc:Icon-flag-{{{1}}}}}.png|16px|link={{#if:{{{2|}}}
|{{#switch:{{{1}}}
  | fr = fr:{{{2}}}
  | en = en:{{{2}}}
  | es = es:{{{2}}}
  }}
|{{#switch:{{{1}}}
  | fr = fr:Accueil
  | en = en:Home
  | es = es:Inicio
  }}
}}|alt={{{1}}}]]
</onlyinclude></includeonly>
<noinclude><templatedata>
<noinclude><templatedata>
{
{
     "description": "Displays a flag icon based on a language code (fr, en, es).",
     "description": "Displays a flag icon based on a language code (fr, en, es). If a page name is provided, the flag links to that page on the corresponding wiki. If not provided, it links to the default homepage of that language.",
     "params": {
     "params": {
         "1": {
         "1": {
             "label": "Language code",
             "label": "Language code",
             "description": "Language code to display the corresponding flag (e.g. fr, en, es).",
             "description": "Language code to display the corresponding flag (fr, en, es).",
             "type": "string",
             "type": "string",
             "required": true,
             "required": true,
Line 15: Line 28:
                 "es"
                 "es"
             ]
             ]
        },
        "2": {
            "label": "Page name",
            "description": "Optional page name to link to on the target wiki. If omitted, the flag links to the default homepage (Accueil, Home, Inicio).",
            "type": "wiki-page-name",
            "required": false,
            "example": "fr:Accueil"
         }
         }
     }
     }
Line 31: Line 51:
|-
|-
| <code><nowiki>{{Flag|es}}</nowiki></code> || {{Flag|es}}
| <code><nowiki>{{Flag|es}}</nowiki></code> || {{Flag|es}}
|-
| <code><nowiki>{{Flag|fr|fr:Template:Flag}}</nowiki></code> || {{Flag|fr|fr:Template:Flag}}
|-
| <code><nowiki>{{Flag|en|en:Template:Flag}}</nowiki></code> || {{Flag|en|en:Template:Flag}}
|-
| <code><nowiki>{{Flag|es|es:Template:Flag}}</nowiki></code> || {{Flag|es|en:Template:Flag}}
|}
|}


[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>

Latest revision as of 15:43, 9 April 2026

Displays a flag icon based on a language code (fr, en, es). If a page name is provided, the flag links to that page on the corresponding wiki. If not provided, it links to the default homepage of that language.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Language code1

Language code to display the corresponding flag (fr, en, es).

Suggested values
fr en es
Example
fr
Stringrequired
Page name2

Optional page name to link to on the target wiki. If omitted, the flag links to the default homepage (Accueil, Home, Inicio).

Example
fr:Accueil
Page nameoptional

Examples

Code Result
{{Flag|fr}}

fr

{{Flag|en}}

en

{{Flag|es}}

es

{{Flag|fr|fr:Template:Flag}}

fr

{{Flag|en|en:Template:Flag}}

en

{{Flag|es|es:Template:Flag}}

es