Project:Flag help
Main flag templates[change]
Basic usage of the main flag templates.
Flag[change]
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}}
→ File:Flag of Poland.svg Poland - Example:
{{flag|United Kingdom}}
→ File:Flag of the United Kingdom.svg United Kingdom
Flagicon[change]
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.
File:Information icon4.svg | 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]
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]
Currently[change]
The template {{Flagcountry}} does the same thing as {{Flagicon}}
Future[change]
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}}
→ File:Flag of the United States.svg United States United States - Example:
{{flagcountry|POL}}
→ File:Flag of Poland.svg Poland Poland
Shortcut flag templates[change]
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]
- Example:
{{AFG}}
→ File:Flag of the Taliban.svg Afghanistan (equivalent to{{flagicon|Afghanistan}}
)
Future[change]
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]
See Category:Flag templates for a complete list.
Flag names[change]
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 File:Flag of Cuba.svg 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}}
→ File:Flag of the United Nations.svg United Nations{{flag|European Union}}
→ File:Flag of Europe.svg European Union{{flag|Texas}}
→ File:Flag of Texas.svg Texas{{flag|Bavaria}}
→ File:Flag of Bavaria (lozengy).svg 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}}
→ File:Flag of Austria-Hungary (1867-1918).svg Austria-Hungary{{flag|Qing Dynasty}}
→ File:Flag of the Qing Dynasty (1889-1912).svg Qing Dynasty{{flag|Nazi Germany}}
→ File:Flag of Nazi Germany.svg Nazi Germany
Alias names[change]
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.
- Example
{{flagicon|United States}}
, may be replaced with{{flagicon|USA}}
to produce United States.
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 Germany.
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.
Caution | 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:
{{flag|USA}}
→ File:Flag of the United States.svg USA{{flag|UK}}
→ File:Flag of the United Kingdom.svg UK{{flag|CHN}}
→ File:Flag of the People's Republic of China.svg CHN
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}}
→ File:Flag of the United States.svg United States United States{{flagcountry|UK}}
→ File:Flag of the United Kingdom.svg United Kingdom United Kingdom{{flagcountry|CHN}}
→ File:Flag of the People's Republic of China.svg China People's Republic of China
Flag variants[change]
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}}
→ File:Flag of the German Empire.svg Germany{{flag|Germany|variant=empire}}
→ File:Flag of the German Empire.svg Germany{{flagcountry|CAN|1921}}
→ File:Canadian Red Ensign (1921–1957).svg Canada{{flagicon|CAN|1921}}
→ Canada
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.
Caution | 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]
Size[change]
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
{{flagicon|Brazil|size=40px}}
→ Brazil{{flag|Italy}}
→ File:Flag of Italy.svg Italy{{flag|Italy|size=15px}}
→ File:Flag of Italy.svg Italy
Name[change]
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}}
→ File:Flag of South Korea.svg Korea (this name is used in several sports){{flag|ROC|name=China}}
→ File:Flag of the Republic of China.svg China (China from 1912 to 1949)
File:Information icon4.svg | 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]
Flaglink[change]
File:Ambox important.svg | 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}}
→ File:Flag of Serbia.svg Serbia{{flaglink|AUS|at the 2002 Commonwealth Games}}
→ File:Flag of Australia (converted).svg Australia
Military flag templates[change]
Army[change]
{{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}}
→ File:Flag of the Korean People's Army Ground Force.svg Korean People's Army Ground Force
Air force[change]
{{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}}
→ File:PL air force flag IIIRP.svg Polish Air Force
[change]
{{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}}
→ File:Naval Ensign of Poland.svg Polish Navy - Example:
{{Navy|Poland|1919}}
→ File:Naval Ensign of IIRP v1.svg Polish Navy
National sport team flag templates[change]
Caution | 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 | File:Flag of Italy.svg Italy | France File:Flag of France.svg | File:Flag of Italy.svg Italy |
Women's national teams | {{fbw}} | {{fbw-rt}} | {{fbw-big}} |
Examples | File:Flag of Germany.svg Germany | Brazil File:Flag of Brazil.svg | File:Flag of Germany.svg Germany |
User preference to disable display of flag icons[change]
File:Ambox important.svg | 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; }