Template:Flag: Difference between revisions
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 ( | "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.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Language code | 1 | Language code to display the corresponding flag (fr, en, es).
| String | required |
| Page name | 2 | Optional page name to link to on the target wiki. If omitted, the flag links to the default homepage (Accueil, Home, Inicio).
| Page name | optional |
Examples
| Code | Result |
|---|---|
{{Flag|fr}} |
|
{{Flag|en}} |
|
{{Flag|es}} |
|
{{Flag|fr|fr:Template:Flag}} |
|
{{Flag|en|en:Template:Flag}} |
|
{{Flag|es|es:Template:Flag}} |