Changes
prevent sandbox from being included in category
{{documentation subpage}}
{{high-risk|546000+}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
'''Template:Flagicon''' displays a flag of the named parameter in "icon" size, currently 23×15 pixels maximally (defined in [[Template:Flagicon/core]]), plus a one-pixel border. The image also has a clickable link to the associated article. For an unlinked flag icon, use [[Template:Flagdeco]] instead.
Please consider the [[Wikipedia:Manual of Style (icons)#Flags|Manual of Style section on flag]]s before using this template.
==Usage==
<code><nowiki>{{flagicon|name|variant=|size=|noredlink=}}</nowiki></code>
;name: The first parameter is mandatory, and identifies the name of the country, region, city, etc. A full list of available values can be found in [[:Category:Country data templates]]. For example, [[:Template:Country data Bulgaria]] is used when the ''name'' parameter is specified as <code>Bulgaria</code>. Many flags are also available via shortened "aliases", such as standard three-letter country codes as specified by [[ISO 3166-1 alpha-3]], [[List of IOC country codes|IOC]], or [[List of FIFA country codes|FIFA]]. The list of available "aliases" is found in [[:Category:Country data redirects]]. Many of these country codes could be considered obscure, so it is recommended to use the full country name.
;variant: The second parameter is optional, and identifies a flag variant to be used instead of the standard flag. This is most often used for historical flags but can also be used to specify naval flags, sport-use flags, etc. The list of available flag variants for each country is documented on the specific page for the country data template. For example, [[Template:Country data Bulgaria]] includes a description of each of the available flag variations for Bulgaria. This parameter can be a named parameter (e.g.. "<code>variant=1815</code>"), or a positional parameter, always after the country name.
;size: This parameter is optional, and is used to specify the maximum width and/or height of the flag image. This parameter is specified using standard [[Wikipedia:Extended image syntax|image syntax]].
==Template data==
{{TemplateDataHeader}}
<templatedata>
{
"description": "This template displays a wikilinked flag of the named parameter in 'icon' size, currently 23×15 pixels (defined in Template:Flagicon/core) plus a one-pixel border.",
"params": {
"1": {
"label": "Name",
"description": "Name of the country, region, city, etc.; full name is recommended for countries",
"type": "string",
"required": true
},
"variant": {
"label": "Variant",
"description": "Identifies a flag variant to be used instead of the standard flag, e.g. 1815",
"type": "string",
"required": false,
"aliases": [
"2"
]
},
"size": {
"label": "Maximum dimension",
"description": "The maximum width or height, specified via standard 'extended image syntax' (e.g. x30px)",
"type": "string",
"required": false
},
"noredlink": {
"label": "No redlink",
"description": "If set to any value which evaluates as true (i.e. '1', 'true', 'yes', or 'y'), it displays nothing if the country data file doesn't exist. (The default is to display a redlink)",
"type": "string",
"required": false
}
}
}
</templatedata>
==Examples==
{| class="wikitable"
! Wikicode !! Results !! Notes
|-
| <code><nowiki>{{flagicon|Bulgaria}}</nowiki></code> || {{flagicon|Bulgaria}} ||
|-
| <code><nowiki>{{flagicon|BUL}}</nowiki></code> || {{flagicon|BUL}} || Uses the ISO/IOC/FIFA country code
|-
| <code><nowiki>{{flagicon|Bulgaria|1946}}</nowiki></code> || {{flagicon|Bulgaria|1946}} || rowspan="2"| Specifies a historical flag
|-
| <code><nowiki>{{flagicon|Bulgaria|variant=1946}}</nowiki></code> || {{flagicon|Bulgaria|variant=1946}}
|-
| <code><nowiki>{{flagicon|BUL|naval}}</nowiki></code> || {{flagicon|BUL|naval}} || Specifies the naval ensign
|-
| <code><nowiki>{{flagicon|BUL|air force}}</nowiki></code> || {{flagicon|BUL|air force}} || Specifies the air force flag
|-
| <code><nowiki>{{flagicon|Bulgaria|size=50px}}</nowiki></code> || {{flagicon|Bulgaria|size=50px}} || Sets width to 50 pixels
|-
| <code><nowiki>{{flagicon|Xanadau}}</nowiki></code> || {{flagicon|Xanadau}} || No flag for Xanadu, so displays redlink
|-
| <code><nowiki>{{flagicon|Xanadu|noredlink=yes}}</nowiki></code> || {{flagicon|Xanadu|noredlink=yes}} || No flag, so displays nothing
|}
==Implementation notes==
This template uses the data templates listed under [[:Category:Country data templates]], which contain the data specifying '''what''' to display and the formatter [[Template:Flagicon/core]], which contains the logic of '''how''' to display the flag.
* <code><nowiki>{{flagicon|Bulgaria}}</nowiki></code> → {{flagicon|Bulgaria}} — uses [[Template:Country data Bulgaria]]
* <code><nowiki>{{flagicon|BUL}}</nowiki></code> → {{flagicon|BUL}} — uses [[Template:Country data BUL]], which is a redirect to [[Template:Country data Bulgaria]]
Inside each country data template, this template uses the following parameters:
* <code>flag alias</code> — name of the image file to display
* <code>flag alias-xxxx</code> — name of the image file of flag variant <code>xxxx</code>
* <code>alias</code> — used to display the [[alt attribute]] of the image (defaults to "Flag of ''alias''")
== Tracking categories ==
Where <code><nowiki>{{Flagicon|Foo}}</nowiki></code> is used, but the <code><nowiki>Template:Country data Foo</nowiki></code> does not exist, then a [[WP:REDLINK|redlink]] is displayed, ''unless'' the {{para|noredlink|yes}} parameter has been set.
Where the redlink is displayed, the page is addded to a tracking category:
* [[:Category:Flagicons with missing country data templates]] (population: {{PAGESINCATEGORY|Flagicons with missing country data templates}})
==Related templates==
* [[Template:Flag]] is used to display a wikilinked name next to the flag. The displayed name will be the same as the parameter used with the template, but the link target will be the main article for the country (in these examples, [[Bulgaria]]).
** <code><nowiki>{{flag|Bulgaria}}</nowiki></code> → {{flag|Bulgaria}}
** <code><nowiki>{{flag|BUL}}</nowiki></code> → {{flag|BUL}}
* [[Template:Flagcountry]] is also used to display a wikilinked name next to the flag. The displayed name will always be the same, regardless of whether or not a country code alias is used as the template parameter.
** <code><nowiki>{{flagcountry|Bulgaria}}</nowiki></code> → {{flagcountry|Bulgaria}}
** <code><nowiki>{{flagcountry|BUL}}</nowiki></code> → {{flagcountry|BUL}}
* [[Template:Flagdeco]] displays an unlinked flag icon without country name.
** <code><nowiki>{{flagdeco|Bulgaria}}</nowiki></code> → {{flagdeco|Bulgaria}}
For a full list of flag templates, see [[:Category:Flag template system]].
==See also==
* [[Template:Coat of arms]]
* [[Wikipedia:WikiProject Flag Template]]
<includeonly>{{Sandbox other||
[[Category:Flag template system]]
}}</includeonly>
{{high-risk|546000+}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
'''Template:Flagicon''' displays a flag of the named parameter in "icon" size, currently 23×15 pixels maximally (defined in [[Template:Flagicon/core]]), plus a one-pixel border. The image also has a clickable link to the associated article. For an unlinked flag icon, use [[Template:Flagdeco]] instead.
Please consider the [[Wikipedia:Manual of Style (icons)#Flags|Manual of Style section on flag]]s before using this template.
==Usage==
<code><nowiki>{{flagicon|name|variant=|size=|noredlink=}}</nowiki></code>
;name: The first parameter is mandatory, and identifies the name of the country, region, city, etc. A full list of available values can be found in [[:Category:Country data templates]]. For example, [[:Template:Country data Bulgaria]] is used when the ''name'' parameter is specified as <code>Bulgaria</code>. Many flags are also available via shortened "aliases", such as standard three-letter country codes as specified by [[ISO 3166-1 alpha-3]], [[List of IOC country codes|IOC]], or [[List of FIFA country codes|FIFA]]. The list of available "aliases" is found in [[:Category:Country data redirects]]. Many of these country codes could be considered obscure, so it is recommended to use the full country name.
;variant: The second parameter is optional, and identifies a flag variant to be used instead of the standard flag. This is most often used for historical flags but can also be used to specify naval flags, sport-use flags, etc. The list of available flag variants for each country is documented on the specific page for the country data template. For example, [[Template:Country data Bulgaria]] includes a description of each of the available flag variations for Bulgaria. This parameter can be a named parameter (e.g.. "<code>variant=1815</code>"), or a positional parameter, always after the country name.
;size: This parameter is optional, and is used to specify the maximum width and/or height of the flag image. This parameter is specified using standard [[Wikipedia:Extended image syntax|image syntax]].
==Template data==
{{TemplateDataHeader}}
<templatedata>
{
"description": "This template displays a wikilinked flag of the named parameter in 'icon' size, currently 23×15 pixels (defined in Template:Flagicon/core) plus a one-pixel border.",
"params": {
"1": {
"label": "Name",
"description": "Name of the country, region, city, etc.; full name is recommended for countries",
"type": "string",
"required": true
},
"variant": {
"label": "Variant",
"description": "Identifies a flag variant to be used instead of the standard flag, e.g. 1815",
"type": "string",
"required": false,
"aliases": [
"2"
]
},
"size": {
"label": "Maximum dimension",
"description": "The maximum width or height, specified via standard 'extended image syntax' (e.g. x30px)",
"type": "string",
"required": false
},
"noredlink": {
"label": "No redlink",
"description": "If set to any value which evaluates as true (i.e. '1', 'true', 'yes', or 'y'), it displays nothing if the country data file doesn't exist. (The default is to display a redlink)",
"type": "string",
"required": false
}
}
}
</templatedata>
==Examples==
{| class="wikitable"
! Wikicode !! Results !! Notes
|-
| <code><nowiki>{{flagicon|Bulgaria}}</nowiki></code> || {{flagicon|Bulgaria}} ||
|-
| <code><nowiki>{{flagicon|BUL}}</nowiki></code> || {{flagicon|BUL}} || Uses the ISO/IOC/FIFA country code
|-
| <code><nowiki>{{flagicon|Bulgaria|1946}}</nowiki></code> || {{flagicon|Bulgaria|1946}} || rowspan="2"| Specifies a historical flag
|-
| <code><nowiki>{{flagicon|Bulgaria|variant=1946}}</nowiki></code> || {{flagicon|Bulgaria|variant=1946}}
|-
| <code><nowiki>{{flagicon|BUL|naval}}</nowiki></code> || {{flagicon|BUL|naval}} || Specifies the naval ensign
|-
| <code><nowiki>{{flagicon|BUL|air force}}</nowiki></code> || {{flagicon|BUL|air force}} || Specifies the air force flag
|-
| <code><nowiki>{{flagicon|Bulgaria|size=50px}}</nowiki></code> || {{flagicon|Bulgaria|size=50px}} || Sets width to 50 pixels
|-
| <code><nowiki>{{flagicon|Xanadau}}</nowiki></code> || {{flagicon|Xanadau}} || No flag for Xanadu, so displays redlink
|-
| <code><nowiki>{{flagicon|Xanadu|noredlink=yes}}</nowiki></code> || {{flagicon|Xanadu|noredlink=yes}} || No flag, so displays nothing
|}
==Implementation notes==
This template uses the data templates listed under [[:Category:Country data templates]], which contain the data specifying '''what''' to display and the formatter [[Template:Flagicon/core]], which contains the logic of '''how''' to display the flag.
* <code><nowiki>{{flagicon|Bulgaria}}</nowiki></code> → {{flagicon|Bulgaria}} — uses [[Template:Country data Bulgaria]]
* <code><nowiki>{{flagicon|BUL}}</nowiki></code> → {{flagicon|BUL}} — uses [[Template:Country data BUL]], which is a redirect to [[Template:Country data Bulgaria]]
Inside each country data template, this template uses the following parameters:
* <code>flag alias</code> — name of the image file to display
* <code>flag alias-xxxx</code> — name of the image file of flag variant <code>xxxx</code>
* <code>alias</code> — used to display the [[alt attribute]] of the image (defaults to "Flag of ''alias''")
== Tracking categories ==
Where <code><nowiki>{{Flagicon|Foo}}</nowiki></code> is used, but the <code><nowiki>Template:Country data Foo</nowiki></code> does not exist, then a [[WP:REDLINK|redlink]] is displayed, ''unless'' the {{para|noredlink|yes}} parameter has been set.
Where the redlink is displayed, the page is addded to a tracking category:
* [[:Category:Flagicons with missing country data templates]] (population: {{PAGESINCATEGORY|Flagicons with missing country data templates}})
==Related templates==
* [[Template:Flag]] is used to display a wikilinked name next to the flag. The displayed name will be the same as the parameter used with the template, but the link target will be the main article for the country (in these examples, [[Bulgaria]]).
** <code><nowiki>{{flag|Bulgaria}}</nowiki></code> → {{flag|Bulgaria}}
** <code><nowiki>{{flag|BUL}}</nowiki></code> → {{flag|BUL}}
* [[Template:Flagcountry]] is also used to display a wikilinked name next to the flag. The displayed name will always be the same, regardless of whether or not a country code alias is used as the template parameter.
** <code><nowiki>{{flagcountry|Bulgaria}}</nowiki></code> → {{flagcountry|Bulgaria}}
** <code><nowiki>{{flagcountry|BUL}}</nowiki></code> → {{flagcountry|BUL}}
* [[Template:Flagdeco]] displays an unlinked flag icon without country name.
** <code><nowiki>{{flagdeco|Bulgaria}}</nowiki></code> → {{flagdeco|Bulgaria}}
For a full list of flag templates, see [[:Category:Flag template system]].
==See also==
* [[Template:Coat of arms]]
* [[Wikipedia:WikiProject Flag Template]]
<includeonly>{{Sandbox other||
[[Category:Flag template system]]
}}</includeonly>