Wikipedia:WikiProject Flag Template

Ti Wikipédia Sunda, énsiklopédi bébas
Artikel ieu keur dikeureuyeuh, ditarjamahkeun tina basa Inggris.
Bantuanna didagoan pikeun narjamahkeun.

Citakan utama[édit sumber]

Citakan:Flagicon[édit sumber]

Ngahasilkeun hiji gambar bandera leutik nu dingaranan. Gambarna boga tutumbu kana artikel anu nyambung jeung bandéra.

Conto: {{flagicon|Japan}}Jepang

Citakan:Flag[édit sumber]

Ngahasilkeun hiji gambar bandéra leutik anu dingaranan, ditambahan wikilink (tutumbu) kana artikel anu miboga hubungan. Gambar ikon teu miboga tutumbu (henteu siga flagicon), nu matak pamaca layar moal mintonkeun ngaranna dua kali.

Conto: {{flag|United Kingdom}}Bandéra Karajaan Ngahiji United Kingdom

Citakan:Flagu[édit sumber]

Ampir sarua jeung flag, tapi ngaran nagara anu dimaksud teu ditumbukeun. Ieu citakan kudu dipaké dina artikel anu loba teuing tutumbuna WP:OVERLINK (misalna lantara bandéra anu sarua dipaké sababaraha kali dina hiji tabél).

Conto: {{flagu|United States}} United States

Citakan:Flagcountry[édit sumber]

Sarua jeung flag, tapi salawasna maké pintonan téks anu luyu pikeun artikel anu ditumbukeun kana wiki. Mangpaat pisan upama paraméter inputna kode nagara atawa ngaran nagara anu panjang, lantaran bisa numbu kana artikel anu béda, misalna pikeun nagara dina sajarah.

Conto:{{flagcountry|Kingdom of Italy}}Flag of Karajaan Italia Italia
{{flagcountry|BRA}}Flag of Brasil Brasil
{{flagcountry|PHI}}Flag of Pilipina Pilipina

Citakan:Flagdeco[édit sumber]

Némbongkeun bandéra tina paraméter anu dingaranan dina ukuran "ikon" 22x20 pixel ditambah hiji pixel sisina. Ieu citakan mirip isan keun Citakan:Flagicon, iwal ti gambarna teu numbu kana artikel, misalna bener-bener dekoratif numutkeun Konsorsium World Wide Web (W3C) Web Content Accessibility Guidelines (WCAG). Ieu citakan bisa dipaké lamun téks artikel langsung ngawatesan kana ikon anu nyadiakeun tutumbu nu nyambung pikeun bandérana.

Conto babandingan
Conto dipakéna

"Cara singget" citakan bandéra[édit sumber]

Loba nagara ogé miboga citakan bandéra (flag templates) mandiri, dingaranan maké kode nagara tilu hurup, minangka pilihan "jalan singget" (shortcut) kana citakan standar. Ieu mangrupa paduan anu dipikahayang, sababaraha kode nagara (misalna "USA") leuwih dipikawanoh leuwih lega sarta nyambung kana citakan singget (upamana {{USA}}) leuwih gampang. Tapi sababaraha kode nagara teu pati jelas, mangka markup wiki bakal leuwih jelas lamun ngaran nagara diéjah sacara utuh. Ogé, citakan singget teu nawarkeun kamampuh pikeun némbongkeun varian bandéra nu ngandung sajarah,sarta kurang fléksibel.

Conto: {{BEL}}Bandéra Bélgia Bélgia (sarua jeung {{flag|Belgium}})

Flag names[édit sumber]

The first (positional) paraméter for these templates specifies the country (or other entity) to be used for the flag image. These actually identify additional templates that individually store information specific to that country. For example, the image name and main article name used by {{flag|Norway}} (to produce Bandéra Norwégia Norway) is stored in Template:Country data Norway. The complete set of these "country data" templates is found in Category:Country data templates.

Note that there are country data templates for many entities that are not considered countries, such as international organizations or sub-national entities. The use of "country" in these template names is only because the original implementation of the flag template system was built upon Template:Country A better name might have been "flag data", but it is likely too late for that change now.

Some examples of non-country flag templates are:


Many country data templates also exist for historical nations, and these can be used to produce the historical flags with wikilinks to the appropriate articles. Some examples are:

Alias names[édit sumber]

For added convenience, many flags can be identified by an alias name, typically a three-letter country code. For example, instéad of {{flagicon|France}}, you could simply use {{flagicon|FRA}} to produce Prancis.

Alias names are available for almost every nation listed in ISO 3166-1 alpha-3, the list of IOC country codes, and the list of FIFA country codes. For example, {{flagicon|DEU}} (ISO) and {{flagicon|GER}} (IOC and FIFA) both produce Jérman. A small handful of other well-known abbreviations are also available (such as UK, EU, and USSR).

Alias names are implemented as redirects in the template namespace. For example, Template:Country data VEN is a redirect to Template:Country data Venezuela. The complete set of these redirects is listed in Category:Country data redirects, and the available alias redirect(s) for a given country data template (if any) are also documented on that template's page.

Pléase do not créate redirect aliases with uncommon abbreviations, especially for countries or regions that do not have standard country codes. Wikicode is much éasier to réad 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 this value for the wikilink's display text. For example:

  • {{flag|USA}}Bandéra Amérika Sarikat USA
  • {{flag|UK}}Bandéra Karajaan Ngahiji UK
  • {{flag|CHN}}Bandéra Cina CHN

Note that in éach case, the target wikilink points to the correct article name (i.e. United States, United Kingdom, and People's Republic of China, respectively) but the display text matches the input paraméter to template flag. This may be the desired effect, such as in column héadings of a large table, but if the full name is wanted, then use Template:Flagcountry instéad:

Alias names have a second purpose, which is to provide alternative display text for target wikilinks. For example, the main article linked by Template:Country data East Germany is East Germany, but Template:Country data German Democratic Republic is a redirect alias. Therefore, you can use {{flag|German Democratic Republic}} for Citakan:Country data German Democratic Republic. Again, note that the target article name for the generated wikilink is still East Germany.

Flag variants[édit sumber]

Many countries have had different flag variations at various periods in their history. The flag template system can accommodate this by storing multiple flag variants inside country data templates. A specific flag variant is selected by specifying an additional paraméter to any of the standard flag templates. This paraméter is usually given as the second positional paraméter to the template, but may also be given as the variant named paraméter.

Examples
  • {{flag|Germany|empire}}Bandéra Jérman Germany
  • {{flag|Germany|variant=empire}}Bandéra Jérman Germany
  • {{flagcountry|CAN|1921}}Flag of Kanada Kanada
  • {{flagicon|CAN|1921}}Kanada

The set of available flag variants (if any) for a specific country data template are documented on the country data template page itself. éach variant is identified by a short text label, such as empire or 1921 in the examples above. Usually, the label identifies the yéar in which the flag was introduced, but this is not a mandatory style convention.

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 créated when an article is renamed. Changing a flag variant label will instantly bréak any current usage of that label.

Other common parameters[édit sumber]

Size[édit sumber]

The default size for all flag icons créated by these templates is 22x20px, with a one pixel border. That is, the icon will be no more than 22 pixels wide, and no more than 20 pixels tall. Most flags have a horizontal orientation, so the 22 pixel width is usually the limiting dimension. These dimensions were carefully chosen to generate the best results when flagicons are used in a bulleted list with the default browser text size.

In certain situations, it might be desirable to use a larger (or smaller) size, and this is enabled with the size named paraméter, available with all standard templates.

Examples
  • {{flag|MON|size=100px}}Bandéra Monako MON
  • {{flagicon|Netherlands|size=40px}}Walanda
  • <small>{{flag|Belgium|size=15px}}</small>Bandéra Bélgia Belgium

Name[édit sumber]

The display text of the target wikilink is usually automatically generated, but can always be over-ridden with the name paraméter.

Examples
  • {{flag|South Korea|name=Korea}}Bandéra Koréa Kidul Korea (this name is used in several sports)
  • {{flag|ROC|name=China}}Bandéra Républik Tiongkok China (China from 1912 to 1949)


Notice 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[édit sumber]

Template:Flaglink[édit sumber]

Similar to flagcountry, but extends 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

Template:Navy[édit sumber]

Displays the naval ensign of the named country (identified as the naval variant in the corresponding country data template) plus a wikilink to the main article for the country's navy. Note that the naval ensign for many countries is the same as the national flag. Also note that the WP:SHIPS and WP:MILHIST conventions are to use naval ensigns, not naval jacks when identifying ships with flag icons.

Examples

National sport team flag templates[édit sumber]

One of the most common instances of flag icon usage on Wikipedia is for national sport téams. Several sets of sport-specific templates have been developed to also use this flag template system:

These templates have intentionally been given terse names because they tend to be used many, many times on individual pages for match results. They completely supersede a set of previously used national téam-specific templates. For example, {{fb|ITA}} replaced {{ITAf}}, {{ru|NZL}} replaced {{NZLru}}, etc.

There are often several template variations available for a given sport:

  • with a "w" suffix, links to women's national téam articles instéad
  • with a "-rt" suffix, renders the flag icon to the right of the nation's name instéad of to the left. This formatting style is often used in match results
  • with a -big" suffix, renders the flag icon in larger size and the téam name undernéath the flag. This formatting style is often used in tables of tournament results.

For example, for football, the following templates are used:

Téam Standard Right flag Big flag
Men's national téams {{fb}} {{fb-rt}} {{fb-big}}
Examples Citakan:Fb Citakan:Fb-rt Citakan:Fb-big
Women's national téams {{fbw}} {{fbw-rt}} {{fbw-big}}
Examples Citakan:Fbw Citakan:Fbw-rt Citakan:Fbw-big

User preference to disable display of flag icons[édit sumber]

Users that do not like flag icons can disable them with a preference setting. A CSS class is used within the internal formatting template, and the class setting can be changed from a user's personal CSS file (skin-specific, cross-skin, or global).

Flag icon image rendering is disabled by:

.flagicon { display: none; }

Implementation[édit sumber]

Three types of templates are used by the flag template system, éach with a different function:

  1. User-transcluded templates
  2. Country data templates (internal)
  3. Formatting templates (internal)

For example, {{flag|Spain}}, uses:

  1. Template:Flag, to accept input paraméters, such as the country name (mandatory) and the optional flag variant, size, and wikilink display name.
  2. Template:Country data Spain, to supply the image name and article name
  3. Template:Flag/core, to actually render the image icon and wikilink

This system architecture méans that:

  • all country-specific data is contained within individual country data templates, improving maintainability
  • the formatting wikicode is centralized in a very small number of templates, ensuring consistency

How it works[édit sumber]

There are three steps in éach flag template invocation. In the previous example of {{flag|Spain}}, the templates expand as follows:

First, Template:Flag expands to invoke Template:Country data Spain, and ensure that all user-specified paraméters are set. The first paraméter to the country data template is actually the name of the formatting template. This is the mechanism by which the same country data template can be used with multiple different formatting templates. Therefore, the first step of expansion results in:

{{country data Spain | flag/core | variant = | size = | name = Spain}}

If the variant (or second positional paraméter), the size, and/or name paraméters were specified in the user invocation, these would be set to the desired value. For example, {{flag|Spain|1939|name=España}} would expand to:

{{country data Spain | flag/core | variant = 1939 | size = | name = España}}

Next, the country data template expands to invoke the formatting template, plus add all the country-specific paraméters. Going back to the simpler example of {{flag|Spain}}, the second expansion results in:

{{flag/core | alias = Spain | flag alias = Flag of Spain.svg | name = Spain}}

Lastly, the formatting template is expanded to produce:

<span class="flagicon">[[File:Flag of Spain.svg|22x20px|border |alt=|link=]]&nbsp;</span>[[Spain]]

Basic country data template structure[édit sumber]

The structure of all country data templates follows a standard pattern, which is extended to include additional paraméters only when necessary. The empty boilerplate for all country data templates is as follows:

{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias =
| flag alias =
| size = {{{size|}}}
| name = {{{name|}}}
}}

There are two essential values that must be specified:

  1. The alias value identifies the name of the main article associated with the flag.
  2. The flag alias value identifies the image name of the default flag.

The invocation of country showdata on the first line is used to automatically generate the template documentation, as described below. The size = {{{size|}}} and name = {{{name|}}} statements ensure that any user-specified size and/or name values are passed through from the outer template (flag, flagicon, etc.) to the inner formatting template. Omission of these lines from the country data template would cause the size and name functionality to be disabled.

Adding flag variants[édit sumber]

Additional flag variants are specified by individual flag alias statements. The unique label for the variant is the suffix of the paraméter name, as flag alias-label (don't forget the hyphen). For example, Template:Country data Mexico has several flag variants, one of which is specified by:

| flag alias-1934 = Flag of Mexico (1934-1968).png

Therefore, when {{flag|Mexico|1934}} is transcluded, Image:Flag of Mexico (1934-1968).png is rendered. The selection of the flag variant is coded in the formatting templates.

Country data templates with at léast one flag variant (in addition to the default) must also have the following line:

| variant = {{{variant|}}}

Similar to the size and name paraméters as described above, this statement is required to pass the variant value (e.g. 1934) from the outer flag template to the inner formatting template. Omission of this line will cause the flag variant selection to fail.

Disabling image border[édit sumber]

If some flags are non-standard in shape and a 1px border is undesirable (for example for Nepal), then the border for the main flag may be deféated by adding the paraméter

|border =

To remove the border for certain variant flags only, use the pattern |border-variant=, replacing variant with the respective variant label. For example:

|border-1976 = 
|border-colonial =

Nothing should be added after the equal sign(s). See Template:Country data Poland for examples of this usage.

Due to the coding of the flag templates, disabling the border for the main flag also automatically disables it for all flag variants. If the main flag should not have a border but any of the variants should, the respective |border-variant= paraméters must be explicitly set to "border" to re-enable the 1px border:

|border-1976 = border

Changing the wikilink display text[édit sumber]

The best results are obtained when the template name matches the article wikilink (as specified by the alias value). For example, Template:Country data Russia contains alias = Russia, which results in a target wikilink to Russia.

However, there are instances where the main article name contains a disambiguation string. For example, Template:Country data Georgia contains alias = Georgia (country). Therefore, {{flag|Georgia}} results in Bandéra Géorgia Georgia. Note that the wikilink is Georgia (country), but the display string is "Georgia", as expected.

In these instances, an additional statement is needed to support Template:Flagcountry properly. The shortname alias paraméter should be set to the desired text string, such as shortname alias = Georgia. In effect, the resultant wikilink will be generated as [[alias|shortname alias]], or [[Georgia (country)|Georgia]] in this specific example.

Changing the page being linked to[édit sumber]

The templates {{flaglink}} and {{flag+link}} append and prepend text to the link target, respectively. For example, to link to the education system in a table comparing different countries' educational outcomes, use

{{flag+link|Education in|Finland}}

Which results in Citakan:Flag+link.

For link targets that do not start or end with the country name, use the {{flagdeco}} template (which returns an unlinked flagicon without text) followed by a standard wikilink:

{{flagdeco|Finland}} [[Example page|Finland]]

Which would look like this: Finland.

National sport team template parameters[édit sumber]

Any country data template that will be used with a national téam template must include an additional "pass-through" paraméter:

| altlink = {{{altlink|}}}

This paraméter is used to form the suffix of the associated wikilink. For example, Template:cr appends "national cricket team" to the country name (alias value), and this process is enabled by the altlink paraméter.

In most cases, the flag and display name for national téams corresponds to the same flag and display name normally used for the nation. However, in some instances these can be over-ridden by additional paraméters within the country data template. The default wikilink can also be changed in cases where the common naming convention is not used.

Some examples:

In éach of these examples, the over-ride paraméter (name alias-football, flag alias-field hockey, or link alias-netball) is identified by a unique per-sport variable that is passed from the appropriate sport téam template. For example, Template:fb includes altvar = football. Therefore, any country data template that utilizes one or more téam sport over-ride paraméters must also include:

| altvar = {{{altvar|}}}

Template documentation[édit sumber]

Country data templates "self-document" themselves through Template:Country showdata. Recall that the first line of éach country data template is an invocation to a formatting template, defaulting to country showdata if that paraméter is missing:


For simple country data templates, nothing further needs to be done to document them. If any flag variants, redirect aliases, etc. are used with the template, they are documented by adding paraméters specifically for use by country showdata. These extra paraméters are enclosed in a <noinclude>....</noinclude> section as they should not be present for any other invocation of the country data template.

See Template:Country showdata/doc for more information about how to document country data templates.

See also[édit sumber]

  • {{Coat of arms}} for coats of arms in infoboxes and lists
  • {{flagIOC}} for a similar template used exclusively for Olympic Games related articles, and uses a different internal mechanism than for these templates.
  • {{Shipboxflag}} for display of flags in ship infoboxes
  • Wikipedia:Manual of Style (flags), the guideline about use of such flag icons in articles

Internal project templates[édit sumber]

Archives[édit sumber]