Difference between revisions of "Template:Flag/doc"

From comp.tf
Jump to navigation Jump to search
 
(4 intermediate revisions by 2 users not shown)
Line 14: Line 14:
 
  ! You get
 
  ! You get
 
|-
 
|-
  ! Full name
+
  ! style="font-weight:normal" | ''Full name''
 
  | <code><nowiki>{{flag|United Nations}}</nowiki></code>
 
  | <code><nowiki>{{flag|United Nations}}</nowiki></code>
 
  | {{flag|United Nations}}
 
  | {{flag|United Nations}}
 
|-
 
|-
  ! Alternate name
+
  ! style="font-weight:normal" | ''Alternate name''
 
  | <code><nowiki>{{flag|world}}</nowiki></code>
 
  | <code><nowiki>{{flag|world}}</nowiki></code>
 
  | {{flag|world}}
 
  | {{flag|world}}
 
|-
 
|-
  ! Abbreviation
+
  ! style="font-weight:normal" | ''Abbreviation''
 
  | <code><nowiki>{{flag|un}}</nowiki></code>
 
  | <code><nowiki>{{flag|un}}</nowiki></code>
 
  | {{flag|un}}
 
  | {{flag|un}}
 
|-
 
|-
  ! No parameter
+
  ! style="font-weight:normal" | ''No parameter''
 
  | <code><nowiki>{{flag|}}</nowiki></code>
 
  | <code><nowiki>{{flag|}}</nowiki></code>
 
  | {{flag|}}
 
  | {{flag|}}
 
|-
 
|-
  ! Invalid parameter
+
  ! style="font-weight:normal" | ''Invalid parameter''
 
  | <code><nowiki>{{flag|invalid}}</nowiki></code>
 
  | <code><nowiki>{{flag|invalid}}</nowiki></code>
 
  | {{flag|invalid}}
 
  | {{flag|invalid}}
Line 43: Line 43:
 
=== 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]]
 
 
|-
 
|-
  | [[Template:Flag/oceania|Oceania]]
+
  | style="width: 29px;" | {{flag|asean}}
|-
+
  | style="width: 44px;" | [[Template:Flag/asean|<code>asean</code>]]
  | [[Template:Flag/australia/new zealand|Australia/New Zealand]]
+
  | style="width: 160px;" | [[Template:Flag/asean|ASEAN]]
|-
 
| [[Template:Flag/nzau|<code>nzau</code>]]
 
  | [[Template:Flag/new zealand/australia|New Zealand/Australia]]
 
 
|-
 
|-
 
  | rowspan=2 | {{flag|ukus}}
 
  | rowspan=2 | {{flag|ukus}}
Line 69: Line 63:
 
  | [[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 575: Line 580:
 
=== 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 649: Line 660:
 
|}
 
|}
 
{{Box|break|padding=1em}}
 
{{Box|break|padding=1em}}
 +
 
=== N ===
 
=== N ===
 
{| class="wikitable" style="text-align: center;"
 
{| class="wikitable" style="text-align: center;"

Latest revision as of 05:00, 21 June 2022

Template:Flag displays a flag icon.

Usage[edit]

{{flag|1}}

1[edit]

This is the only parameter in the template and is used for defining which country's flag will be shown.

  • All valid settings for flags are listed in the tables below
  • This parameter is case-insensitive.

Examples[edit]

You type You get
Full name {{flag|United Nations}} United Nations
Alternate name {{flag|world}} United Nations
Abbreviation {{flag|un}} United Nations
No parameter {{flag|}} Unknown
Invalid parameter {{flag|invalid}} Template:Flag/invalid

Valid settings[edit]

Note: United Kingdom flags[edit]

The individual flags of England England, Northern Ireland Northern Ireland, Scotland Scotland, and Wales Wales should take preference in all possible circumstances over the United Kingdom United Kingdom flag.

Misc · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z

O[edit]

Oman om Oman

X[edit]

Developer documentation[edit]

How this template works[edit]

  1. Template:Flag takes the input parameter and calls a sub-template at "Template:Flag/X". For example, {{flag|united nations}} will call Template:Flag/united nations.
  2. This sub-template then in turn calls Template:Flag icon, supplying it with a single parameter ({{Flag icon|X}}). For example, Template:Flag/united nations supplies Template:Flag icon with the single parameter United Nations
  3. 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 United Nations, it will supply File:Flag of United Nations.png (United Nations).

How to add a flag[edit]

If you wish to add a flag, the following requirements must be followed:

Image size[edit]

  • Width: equal or less than 23px
  • Height: equal or less than 15px
  • Aspect ratio: retained from source flag

If your flag is a custom flag (e.g. North America), we recommend a 23x15px flag which has a 2:3 ratio.

Upload[edit]

  • Your flag should be uploaded to File:Flag of ProperFlagName.png, where ProperFlagName is the full name of your flag with correct capitalization
  • Make sure you add your flag image to Category:Flag Images.

Update templates[edit]

  • Create a template at Template:Flag/lowercaseflagname, where lowercaseflagname is the full name of your flag in complete lowercase. This template should contain the code below:
{{Flag icon|'''ProperFlagName'''}}<noinclude>[[Category:Flag sub-templates]]</noinclude>
  • Create a template at Template:Flag/abbr, where abbr is the lowercase abbreviation of your flag. This template should be a simple redirect to the primary sub-template (Template:Flag/lowercaseflagname)
    • If your template has any alternate names or abbreviations, create them as simple redirects to the primary sub-template as well
  • Add your flag to the correct table in the documentation template.