Wikipedia:Flag help
Main flag templates
[change source]Basic usage of the main flag templates.
Flag
[change source]The template {{Flag}} will display two things. An icon (a small image) of a flag, and a wikilink to the article (page) of the country. The name of the country is the first parameter passed to the template.
- Example:
{{flag|Poland}}
→ Poland - Example:
{{flag|United Kingdom}}
→ United Kingdom
Flagicon
[change source]The template {{Flagicon}} will display an icon (a small image) of a flag. The name of the country is the first parameter passed to the template.
To display a flag icon and a wikilink to the article of a country, the wikicode {{flag|name}} should be used. |
Differences between flagicon on english and simple wikipedia
[change source]In en:wikipedia, the flag icon is a wikilink to the article about the country. In simple:wikipedia, the flag icon is a wikilink to the full-sized image on wikimedia commons.
Flagcountry
[change source]Currently
[change source]The template {{Flagcountry}} does the same thing as {{Flagicon}}
Future
[change source]The template {{Flagcountry}} will an icon of a flag, and a wikilink to the article (page) of the country. The display format is the same as {{Flag}}, but the common name of the country is used, even if an alternate name or code is used (see Alternate names below). The name of the country is the first parameter passed to the template.
- Example:
{{flagcountry|USA}}
→ United States United States - Example:
{{flagcountry|POL}}
→ Poland Poland
Shortcut flag templates
[change source]Many countries have individual flag templates. These are shortcut flag templates. The template is named using standard three-letter country code. This is a "shortcut" to using the standard Flagicon template.
Currently
[change source]- Example:
{{AFG}}
→ Afghanistan (equivalent to{{flagicon|Afghanistan}}
)
Future
[change source]There are good things and bad things about using the shortcut flag templates.
- Some country codes, like "USA", are widely known. Using the shortcut templates
{{USA}}
makes coding a page easier and faster. - Many country codes are obscure (very few people know them). The wiki markup would be easier to code and read if the country names were used in full.
- The shortcut templates do not allow the use historical flag variants (described below). This makes them less flexible.
List of shortcut templates
[change source]See Category:Flag templates for a complete list.
Flag names
[change source]The first parameter for the {{Flagicon}}, {{Flag}}, and {{Flagcountry}} templates is the country name to be used for the flag image. These country names identify additional templates that store information about that country. For example, the image name and main article name used by {{flag|Cuba}}
(to produce Cuba) is stored in Template:Country data Cuba. The complete set of these "country data" templates is found in Category:Country data templates.
For this discussion, all areas will be called countries.
There are also country data templates for entities that are not considered countries. These other entities can be things such as international organizations, multi-national organizations, state names, province names, or territory names. The use of country in these template names is because the wikicode of the flag template system was built upon {{Country}}. The flag template system was expanded to include these other entities, so the country name had to be used.
Some examples of non-country flag templates are:
{{flag|United Nations}}
→ United Nations{{flag|European Union}}
→ European Union{{flag|Texas}}
→ Texas{{flag|Bavaria}}
→ Bavaria
Many country data templates also have historical nations. These templates may be used to display the historical flags with wikilinks to the appropriate articles. Some examples are:
{{flag|Austria-Hungary}}
→ Austria-Hungary{{flag|Qing Dynasty}}
→ Qing Dynasty{{flag|Nazi Germany}}
→ Nazi Germany
Alias names
[change source]To make writing wikicode for the flag templates easier, many flags can be identified by an alias name. This alias name is typically a three-letter country code.
Alias names are available for almost every nation listed in ISO 3166-1 alpha-3 (the international list of country codes), the list of IOC country codes, and the list of FIFA country codes. For example, {{flagicon|DEU}}
and {{flagicon|GER}}
both produce .
A small group of other well-known abbreviations are also available (such as UK
for the United Kingdom, EU
for the European Union, and USSR
for the Soviet Union.
To find the country code aliases for a country, look at the Country data template for that country. For example, Template:Country data Germany has a section named Redirect aliases. In that section, the codes DEU and GER are listed. These are the country code aliases that may be used to display the German flag.
Please do not create redirect aliases with uncommon abbreviations, especially for countries or regions that do not have standard country codes. Wikicode is much easier to read if the full name is used. Even some of the standard country codes are not widely known! |
When using country code aliases, template {{flag}} will display the country code for the wikilink text. For example:
Note that in each case, the target wikilink is the correct article (i.e. United States, United Kingdom, and People's Republic of China, respectively). This may be the desired effect, such as in column headings of a large table, but if the full name is wanted, then use {{Flagcountry}} instead. This feature is not function at the current time.
{{flagcountry|USA}}
→ United States United States{{flagcountry|UK}}
→ United Kingdom United Kingdom{{flagcountry|CHN}}
→ China People's Republic of China
Flag variants
[change source]Many countries have had different flags in their history. The flag template system can store many flag variants (different versions) inside country data templates. A flag variant is selected by adding an additional parameter to the standard flag templates. This parameter is usually given as the second parameter to the template, but may also be given as the variant
named parameter.
- Examples
{{flag|Germany|empire}}
→ Germany{{flag|Germany|variant=empire}}
→ Germany{{flagcountry|CAN|1921}}
→ Canada{{flagicon|CAN|1921}}
→
The flag variants (if any) for a country are documented on the country data template page itself. Each variant is identified by a label, such as empire
or 1921
in the examples above. Usually, the label identifies the year in which the flag was first used, but this is not a requirement.
Do not change the name of an existing flag variant label unless you are absolutely certain it is not in use. These labels are not like article names, where redirects are created when an article is renamed. Changing a flag variant label will instantly break any current usage of that label. |
Other common parameters
[change source]Size
[change source]The normal size for all flag icons is 22x20px, with a one pixel border. This means that the flag icon will be no more than 22 pixels wide, and no more than 20 pixels tall. Most flags have a horizontal layout (they are wider than they are tall). For these flags the 22 pixel width limits the icon size. This size was picked to display the best looking flag icons for most uses.
Sometimes, it might be better to display a larger or smaller icon. To change the flag icon size, use the size=
parameter. Enter the size followed by the letters px. The size my be the maximum width and or height of the icon.
value | what is limited |
---|---|
40px | maximum width is 40 pixels |
100x50px | maximum width is 100 pixels maximum height is 40 pixels whichever comes first |
x200 | maximum height is 200 pixels |
- Examples
Name
[change source]The text of the wikilink is usually generated by the template, but can always be changed with the name
parameter.
- Examples
{{flag|South Korea|name=Korea}}
→ Korea (this name is used in several sports){{flag|ROC|name=China}}
→ China (China from 1912 to 1949)
Note that if the name parameter is used, then the flagcountry and flag templates are functionally identical. Use template flag for shorter wikicode. |
Other flag templates
[change source]Flaglink
[change source]This feature does not function at this time. |
The template {{Flaglink}} is similar to flagcountry
, but it adds to the wikilink by adding a suffix after the country name. This is useful when a series of per-country articles exist for a main topic.
- Examples
{{flaglink|Serbia|in the Eurovision Song Contest 2007}}
→ Serbia{{flaglink|AUS|at the 2002 Commonwealth Games}}
→ Australia
Military flag templates
[change source]Army
[change source]{{Army}} template is used to display the army flag of a country. The army flag is coded in the country data template. The link to the country's article for their army is also coded in the country data template.
- Example:
{{Army|North Korea}}
→ Korean People's Army Ground Force
Air force
[change source]{{Air force}} template is used to display the air force flag of a country. The air force flag is coded in the country data template. The link to the country's article for their air force is also coded in the country data template.
- Example:
{{Air force|Poland}}
→ Polish Air Force
Navy
[change source]{{Navy}} template is used to display the naval ensign of a country. The naval ensign is coded in the country data template. The link to the country's article for their navy is also coded in the country data template.
- Example:
{{Navy|Poland}}
→ Polish Navy - Example:
{{Navy|Poland|1919}}
→ Polish Navy
National sport team flag templates
[change source]Some of these features are not fully function at this time. |
A common use of the flag icon templates on Wikipedia is for national sport teams. Several sets of sport-specific templates have been built into the flag template system:
These templates have short names because they are often used many times on one page. There are often several template in a set used for a given sport:
- with a "w" suffix, links to women's national team articles
- with a "-rt" suffix, displays the flag icon to the right of the nation's name
- with a -big" suffix, displays the flag icon in larger size and the team name underneath the flag
For example, for football, the following templates are used:
Team | Standard | Right flag | Big flag |
---|---|---|---|
Men's national teams | {{fb}} | {{fb-rt}} | {{fb-big}} |
Examples | Italy | France | Italy |
Women's national teams | {{fbw}} | {{fbw-rt}} | {{fbw-big}} |
Examples | Germany | Brazil | Germany |
User preference to disable display of flag icons
[change source]This feature does not function at this time. |
If a users would not like to see the flag icons displayed, they can disable them. A CSS class is used within the internal formatting template, and the class setting can be changed from a user's personal monobook.css file.
Flag icon image display is disabled by:
.flagicon { display: none; }