Editing Template:Flag/doc

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page is not enabled for semantic in-text annotations due to namespace restrictions. Details about how to enable the namespace can be found on the configuration help page.

Latest revision Your text
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Template:Flag''' displays a flag icon.
+
'''Template:Flag''' displays a flag icon that is 15px high and bordered. This template is used in conjunction with [[Template:Flag/abbr]], which defines the terms that can be used in this template. All of the flag images used in this template can be found at [[:Category:Flag Images]].
 
== Usage ==
 
== Usage ==
<code><nowiki>{{flag|</nowiki>'''<nowiki>1</nowiki>'''<nowiki>}}</nowiki></code>
+
<code><nowiki>{{flag|</nowiki>'''<nowiki>name</nowiki>'''<nowiki>}}</nowiki></code>
=== 1 ===
+
=== name ===
This is the only parameter in the template and is used for defining which country's flag will be shown.
+
This is the only parameter in the template and is used for defining which country's information should be used.
* All valid settings for flags are listed in the tables below
+
*The data entered here will provide the icon with its image and caption/tool tip text.
* This parameter is case-insensitive.
+
*Appropriate settings for this parameter are listed in the table below.
 
+
*Any text entered should be fully lowercase.
 +
*Any special characters (å, é, ì, ô, ū) are not used as they conflict with the wiki's file retrieving system.
 +
*If there is no setting or the setting is invalid (i.e. not listed in the table below) the template will display a placeholder flag, {{flag}}. This is used to keep alignment proper in other templates or to indicate an unknown country.
 
== Examples ==
 
== Examples ==
{| class="wikitable" style="text-align: center;"
+
{| class="wikitable" style="text-align: center; cell-padding: em;"
  | style="background-color:#ecfcf4;border-top:hidden;border-left:hidden" |
+
  ! style="color: white; background-color: #1c1c1c" colspan=3 | You type
! You type
+
  ! style="color: white; background-color: #1c1c1c" colspan=3 | You get
! You get
 
|-
 
  ! style="font-weight:normal" | ''Full name''
 
| <code><nowiki>{{flag|United Nations}}</nowiki></code>
 
| {{flag|United Nations}}
 
 
|-
 
|-
  ! style="font-weight:normal" | ''Alternate name''
+
  | style="border-right:hidden" |
  | <code><nowiki>{{flag|world}}</nowiki></code>
+
  | <code><nowiki>{{flag|antarctica}}</nowiki></code>
  | {{flag|world}}
+
| style="border-left:hidden" |
 +
| style="border-right:hidden" |
 +
  | {{flag|antarctica}}
 +
| style="border-left:hidden" |
 
|-
 
|-
  ! style="font-weight:normal" | ''Abbreviation''
+
  | style="border-right:hidden" |
  | <code><nowiki>{{flag|un}}</nowiki></code>
+
  | <code><nowiki>{{flag|aq}}</nowiki></code>
  | {{flag|un}}
+
| style="border-left:hidden" |
 +
| style="border-right:hidden" |
 +
  | {{flag|aq}}
 +
| style="border-left:hidden" |
 
|-
 
|-
  ! style="font-weight:normal" | ''No parameter''
+
  | style="border-right:hidden" |
| <code><nowiki>{{flag|}}</nowiki></code>
 
| {{flag|}}
 
|-
 
! style="font-weight:normal" | ''Invalid parameter''
 
 
  | <code><nowiki>{{flag|invalid}}</nowiki></code>
 
  | <code><nowiki>{{flag|invalid}}</nowiki></code>
 +
| style="border-left:hidden" |
 +
| style="border-right:hidden" |
 
  | {{flag|invalid}}
 
  | {{flag|invalid}}
 +
| style="border-left:hidden" |
 
|}
 
|}
 
== Valid settings ==
 
== Valid settings ==
=== Note: United Kingdom flags ===
+
A flag can be displayed by either using a country's two letter abbreviation, another name for the country, or the full name of the country in the '''name''' parameter. An alternate list of two letter abbreviations for countries can be found [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements here].
The individual flags of {{flag|uken}} England, {{flag|ukni}} Northern Ireland, {{flag|uksc}} Scotland, and {{flag|ukwa}} Wales should take preference in '''all possible circumstances''' over the {{flag|uk}} United Kingdom flag.
+
{{box|start|padding=4em}}
 +
=== {{flag|uken}} {{flag|ukni}} {{flag|uksc}} {{flag|ukwa}} <small>vs.</small> {{flag|uk}} ===
 +
The individual flags of '''{{flag|uken}} England''', '''{{flag|ukni}} Northern Ireland''', '''{{flag|uksc}} Scotland''', and '''{{flag|ukwa}} Wales''' should take preference in all possible circumstances over the '''{{flag|uk}} United Kingdom''' flag.
 
{| class=wikitable style="width: 100%; text-align: center;"
 
{| class=wikitable style="width: 100%; text-align: center;"
 
|[[Template:Flag#Miscellaneous | Misc]] · [[Template:Flag#A | A]] · [[Template:Flag#B | B]] · [[Template:Flag#C | C]] · [[Template:Flag#D | D]] · [[Template:Flag#E | E]] · [[Template:Flag#F | F]] · [[Template:Flag#G | G]] · [[Template:Flag#H | H]] · [[Template:Flag#I | I]] · [[Template:Flag#J | J]] · [[Template:Flag#K | K]] · [[Template:Flag#L | L]] · [[Template:Flag#M | M]] · [[Template:Flag#N | N]] · [[Template:Flag#O | O]] · [[Template:Flag#P | P]] · [[Template:Flag#Q | Q]] · [[Template:Flag#R | R]] · [[Template:Flag#S | S]] · [[Template:Flag#T | T]] · [[Template:Flag#U | U]] · [[Template:Flag#V | V]] · [[Template:Flag#W | W]] · [[Template:Flag#X | X]] · [[Template:Flag#Y | Y]] · [[Template:Flag#Z | Z]]
 
|[[Template:Flag#Miscellaneous | Misc]] · [[Template:Flag#A | A]] · [[Template:Flag#B | B]] · [[Template:Flag#C | C]] · [[Template:Flag#D | D]] · [[Template:Flag#E | E]] · [[Template:Flag#F | F]] · [[Template:Flag#G | G]] · [[Template:Flag#H | H]] · [[Template:Flag#I | I]] · [[Template:Flag#J | J]] · [[Template:Flag#K | K]] · [[Template:Flag#L | L]] · [[Template:Flag#M | M]] · [[Template:Flag#N | N]] · [[Template:Flag#O | O]] · [[Template:Flag#P | P]] · [[Template:Flag#Q | Q]] · [[Template:Flag#R | R]] · [[Template:Flag#S | S]] · [[Template:Flag#T | T]] · [[Template:Flag#U | U]] · [[Template:Flag#V | V]] · [[Template:Flag#W | W]] · [[Template:Flag#X | X]] · [[Template:Flag#Y | Y]] · [[Template:Flag#Z | Z]]
Line 43: Line 47:
 
=== Miscellaneous ===
 
=== Miscellaneous ===
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"
 +
| rowspan=4 style="width: 29px;" | {{flag|aunz}}
 +
| rowspan=3 style="width: 44px;" | [[Template:Flag/aunz|<code>aunz</code>]]
 +
| style="width: 160px" | [[Template:Flag/australasia|Australasia]]
 
|-
 
|-
  | style="width: 29px;" | {{flag|asean}}
+
  | [[Template:Flag/oceania|Oceania]]
  | style="width: 44px;" | [[Template:Flag/asean|<code>asean</code>]]
+
|-
  | style="width: 160px;" | [[Template:Flag/asean|ASEAN]]
+
  | [[Template:Flag/australia/new zealand|Australia/New Zealand]]
 +
|-
 +
| [[Template:Flag/nzau|<code>nzau</code>]]
 +
  | [[Template:Flag/new zealand/australia|New Zealand/Australia]]
 
|-
 
|-
 
  | rowspan=2 | {{flag|ukus}}
 
  | rowspan=2 | {{flag|ukus}}
Line 63: Line 73:
 
  | [[Template:Flag/nam|<code>nam</code>]]
 
  | [[Template:Flag/nam|<code>nam</code>]]
 
  | [[Template:Flag/north america|North America]]
 
  | [[Template:Flag/north america|North America]]
|-
 
| rowspan=4 | {{flag|aunz}}
 
| rowspan=3 | [[Template:Flag/aunz|<code>aunz</code>]]
 
| [[Template:Flag/australasia|Australasia]]
 
|-
 
| [[Template:Flag/oceania|Oceania]]
 
|-
 
| [[Template:Flag/australia/new zealand|Australia/New Zealand]]
 
|-
 
| [[Template:Flag/nzau|<code>nzau</code>]]
 
| [[Template:Flag/new zealand/australia|New Zealand/Australia]]
 
 
|-
 
|-
 
  | {{flag|sam}}
 
  | {{flag|sam}}
Line 91: Line 90:
 
  | {{flag|}}
 
  | {{flag|}}
 
  | [[Template:Flag/|<code></code>]]
 
  | [[Template:Flag/|<code></code>]]
  | [[Template:Flag/unknown|Unknown]]
+
  | [[Template:Flag/|Unknown]]
 
|}
 
|}
 
{{Box|break|padding=1em}}
 
{{Box|break|padding=1em}}
Line 145: Line 144:
 
=== B ===
 
=== B ===
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"
  | rowspan=2 style="width: 29px;" | {{flag|bs}}
+
  | style="width: 29px;" | {{flag|bs}}
  | rowspan=2 style="width: 44px;" | [[Template:Flag/bs|<code>bs</code>]]
+
  | style="width: 44px;" | [[Template:Flag/bs|<code>bs</code>]]
 
  | style="width: 160px;" | [[Template:Flag/bahamas|Bahamas]]
 
  | style="width: 160px;" | [[Template:Flag/bahamas|Bahamas]]
|-
 
| [[Template:Flag/the bahamas|The Bahamas]]
 
 
|-
 
|-
 
  | {{flag|bh}}
 
  | {{flag|bh}}
Line 580: Line 577:
 
=== M ===
 
=== M ===
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"
|-
 
| rowspan=2 | {{flag|mo}}
 
| rowspan=2 | [[Template:Flag/mo|<code>mo</code>]]
 
| [[Template:Flag/macao|Macao]]
 
|-
 
| [[Template:Flag/macao|Macau]]
 
 
|-
 
|-
 
  | style="width: 29px;" | {{flag|mg}}
 
  | style="width: 29px;" | {{flag|mg}}
Line 660: Line 651:
 
|}
 
|}
 
{{Box|break|padding=1em}}
 
{{Box|break|padding=1em}}
 
 
=== N ===
 
=== N ===
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"
Line 1,067: Line 1,057:
 
{{Box|end}}
 
{{Box|end}}
  
== Developer documentation ==
+
== Adding a flag ==
=== How this template works ===
+
If you wish to add a flag, the following requirements must be followed
# '''Template:Flag''' takes the input parameter and calls a sub-template at "Template:Flag/X". For example, <code><nowiki>{{flag|united nations}}</nowiki></code> will call [[Template:Flag/united nations]].
+
=== Image size ===
# This sub-template then in turn calls [[Template:Flag icon]], supplying it with a single parameter (<code><nowiki>{{Flag icon|X}}</nowiki></code>). For example, Template:Flag/united nations supplies Template:Flag icon with the single parameter <code>United Nations</code>
 
# Template:Flag icon calls for a flag image at "File:Flag of X.png", and applies formatting such as sizing and a 1px border. For example, if Template:Flag icon is given the parameter <code>United Nations</code>, it will supply [[:File:Flag of United Nations.png]] ({{flag|un}}).
 
 
 
* Many of the sub-templates (such as the abbreviations and alternate names) are simple redirects to a primary sub-template. For example, [[Template:Flag/un]], [[Template:Flag/global]], [[Template:Flag/international]] and [[Template:Flag/world]] all redirect to [[Template:Flag/united nations]]. Template:Flag/united nations is the primary sub-template which then calls Template:Flag icon.
 
 
 
=== How to add a flag ===
 
If you wish to add a flag, the following requirements must be followed:
 
==== Image size ====
 
 
*Width: equal or less than 23px
 
*Width: equal or less than 23px
 
*Height: equal or less than 15px
 
*Height: equal or less than 15px
 
*Aspect ratio: retained from source flag
 
*Aspect ratio: retained from source flag
 
If your flag is a custom flag (e.g. {{flag|nam}}), we recommend a 23x15px flag which has a 2:3 ratio.
 
If your flag is a custom flag (e.g. {{flag|nam}}), we recommend a 23x15px flag which has a 2:3 ratio.
==== Upload ====
+
=== Upload ===
*Your flag should be uploaded to <Code>File:Flag of '''ProperFlagName'''.png</code>, where <code>'''ProperFlagName'''</code> is the full name of your flag with correct capitalization
+
*Your flag should be uploaded to <Code>File:Flag of <nowiki><fullflagname></nowiki>.png</code>
*Make sure you add your flag image to [[:Category:Flag Images]].
+
*Make sure you add your flag to [[:Category:Flag Images]]
==== Update templates ====
+
=== Update templates ===
*Create a template at <code>Template:Flag/'''lowercaseflagname'''</code>, where <code>'''lowercaseflagname'''</code> is the full name of your flag in complete lowercase. This template should contain the code below:
+
*[[Template:Flag/abbr]] controls abbreviations and flag names, add your flag with its appropriate abbreviation there
<pre><nowiki>{{Flag icon|</nowiki>'''ProperFlagName'''<nowiki>}}<noinclude>[[Category:Flag sub-templates]]</noinclude></nowiki></pre>
+
*Update the appropriate documentation template at Template:Flag/doc/''FirstLetterOfFullFlagName'' (e.g. [[Template:Flag/doc/s]] for Switzerland)
*Create a template at <code>Template:Flag/'''abbr'''</code>, where <code>abbr</code> is the lowercase abbreviation of your flag. This template should be a simple redirect to the primary sub-template (<code>Template:Flag/'''lowercaseflagname'''</code>)
+
 
**If your template has any alternate names or abbreviations, create them as simple redirects to the primary sub-template as well
+
<noinclude>[[Category:Flag Documentation Templates]]</noinclude>
*Add your flag to the correct table in the [[Template:Flag/doc|documentation template]].<noinclude>[[Category:Flag Documentation Templates]]</noinclude>
 

Please note that all contributions to comp.tf may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see comp.tf:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Templates used on this page: