Template for displaying a tiny flag image. Also shows linked text (probably a country name).

Presently implemented:

The {{country|Action|CountryName}} template is used to display various information about a country.

  • Suggested country code modifiers, using format 'Country_code'-'Modifier':
    • Country_code is the usual country identification code.
    • Modifier is an identification of the specific flag.
    • Examples:
  • Shortcuts:
    • {{flag}}: {{flag|CountryName}}: Flag icon with text linked to country page. (implemented with country|flag)
    • {{flagicon}}: {{flagicon|CountryName}}: Same as country|flagicon.
    • {{flagIOC}}: {{ISO|CountryName}}: Same as country|flagIOC.
    • {{ISO}}: {{ISO|CountryName}}: Same as country|flagISO.
  • country|flag: {{country|flag|CountryName}}: Flag icon with text linked to country page.
    • Each CountryName is connected to a flag file, a Wikipedia article name, and text label. The flag file and text label are displayed, with a link to the Wikipedia article.
  • country|flagicon: {{country|flagicon|CountryName}}: Flag icon alone.
  • country|flagISO: {{country|flagISO|CountryName}}: Flag icon with text linked to country page; name is an ISO 3166-1 country code.
  • country|flagIOC: {{country|flagIOC|CountryName}}: Flag icon with text linked to country's Olympics page; name is an International Olympic Committee country code (see List of IOC country codes).
    • IOC country code usage:
      1. An IOC country code should be used only for general reference to that country's Olympic activities.
        • At present an IOC country code will create a link to that nation's recent Olympics page, as there is no Olympics page for each country.
      2. Names such as flagIOC-2000 should be used for Games which have detailed coverage. This ensures that links will point to specific Games despite future changes.
      3. Use modified country codes such as RUS-SFSR for historical references to Games where a country's reference has changed (ie, different flag).
  • Implemented by invoking {{country|flag|CountryName}}.
    • Uses sub-templates to alias various names for a country to a specific name.
      • At present, all supported countries must have sub-templates. Need better incantation or create templates.
        • A couple of hundred countries have to be supported, plus aliases.
        • Two/three letter abbreviations for each.
        • Some countries have aliases: US, USA, United States, United States of America.
    • Displays aliased Image file name.
    • Displays aliased text label (ie, "US" is aliased to "USA").
    • Links label to Wikipedia article (ie, "US" is linked to United States)

Names supported during testing:

  • none {{country|flag|}}
  • AUS {{country|flag|AUS}}
  • Australia {{country|flag|Australia}}
  • AUT {{country|flag|AUT}}
  • Austria {{country|flag|Austria}}
  • Belgium {{country|flag|Belgium}}
  • Canada {{country|flag|Canada}}
  • Earth {{country|flag|Earth}}
  • Greece {{country|flag|Greece}}
  • ITA {{country|flag|ITA}}
  • Italy {{country|flag|Italy}}
  • POL {{country|flag|POL}}
  • Poland {{country|flag|Poland}}
  • Turkey {{country|flag|Turkey}}
  • US {{country|flag|US}}
  • USA {{country|flag|USA}}
  • United States {{country|flag|United States}}
  • United States of America {{country|flag|United States of America}}

Implementation edit

The technology being used is called a template array: a group of templates whose names follow patterns which are used to address them. For example, the common programming array address A(1,2) can be represented as Template:array_A_1_2.

Defined template array entries appear in this list: templates starting with country_

Template arrays for these templates follow the convention: country_AliasType_alias_CountryName

  • country_: prefix used by templates related to {{country}}.
  • AliasType: optional indicator of type of alias.
  • _alias_: suffix to indicate end of alias type.
  • CountryName: name of country which is being addressed.
    • CountryName-Modifier is also used, for historical or component references, such as Russian-SFSR to refer to Russia while a member of the USSR, or US-WI to refer to the US state of Wisconsin.

Aliasing example edit

Referenced as Template addressed Value in template Usage
US country_alias_US United States Wikipedia article: United States
US country_flag_alias_US Flag of the United States.png Flag: {{country|flagicon|US}}
US country_label_alias_US USA Small text label: {{country|flag|US}}
US country_shortname_alias_US United States Short country name: {{country|flagcountry|US}}

Old proposal: Template:Flag2 edit

  • Summary: {{flag2}} requires 3 parameters:
    1. name of flag file and template appends _flag_large.png.
    2. Wikipedia article name
    3. Text with which to label link to WP article.


Whatch the pro at work. ;) Ok I should be modest right. Your idea is good. But I suggest something like -> Template:Flag2 usage is Flag2|picture you want|text that you want to see

Ill be adding if-else statements once I comprihed how they work on templates. --Cool Cat My Talk 09:50, 10 Apr 2005 (UTC)

Good idea, but templates do not support if-else. I'm a programmer and would have used them. That is causing some of the difficulties in making the Aliasing work well. You probably were confused by the proposals to include if-else. (SEWilco 18:12, 10 Apr 2005 (UTC))
  • Example of template usage: {{Flag2|Us|God Bless America}} Problem when 3 parameter not defined
  • Example of template usage: {{Flag2|Us|God Bless America|God Bless America}}
  • Example of template usage: {{Flag2|Japan|Japan|Land of Anime}}
  • Example of template usage: {{Flag2|France|France|Republic of France}}
  • Of course some links dont work as they shouldnt. --Cool Cat My Talk 10:02, 10 Apr 2005 (UTC)
  • Countriy names folow this general patern(aside from several word countries): First leter capital rest lower case.
    • United States is "Us", as the image is named as so.
That filename oddity in Template:Flag is aliasing, so editors can use several country names or abbreviations. My next testing is in using subst to save the standardized country code, so aliasing does not have to be done always. (SEWilco 18:12, 10 Apr 2005 (UTC))

Plan on makking it like this: Temlate argument 1,2,3 Flag2|1|2|3

  • if 3 not null [[Image: 1 _flag_large.png|20px| 1 ] [[ 2 | 3 ]]
  • else if 2 not null [[Image: 1 _flag_large.png|20px| 1 ] [[ 2 ]]
  • else if 1 not null -> [[Image: 1 _flag_large.png|20px| 1 ] [[ 1 ]]
  • else -> Earth flag. --Cool Cat My Talk
    • I was tempted to make Default be the Yellow Jack, the quarantine flag. :-) (SEWilco)
    • You've noticed by now there is no IF and no default. As it was, it was tricky making a Null flag do something, and that was just a bit of sillyness as few people use Null arguments. (SEWilco)
    • Don't try too hard to make Flag do everything. I'll explain shortly a more general viewpoint. (SEWilco)
    • There are Template sandboxes. "If you with to experiment with templates (and not have your experiments deleted before you are done with them), you may do so in the TemplateSandbox. You may also use the templates X1, X2, and X3 for experimental purposes." (SEWilco)

Well, This way you do not need 1 page per flag. My template works better I think as its more generic. The if else structure would make it perfect. --Cool Cat My Talk 06:07, 11 Apr 2005 (UTC)

    • I am well aware it doesnt exist. I am suggesting what I want to do. We can trick the system you know :) --Cool Cat My Talk 12:29, 11 Apr 2005 (UTC)

Old proposal: Template:Flag4 edit

  • Summary: {{flag4}} requires 3 parameters:
    1. name of flag file and template appends _flag_large.png.
      • Parameter 1 is also assumed to be the link to a Wikipedia article.
    2. Text with which to label link to WP article.

By Pioneer-12 :

My entry into the flag sweepstakes. An adaption of Template:Flag2 by the skillful Coolcat. I think this is the most flexable flag template yet. It displays a flag and optionally displays companion text.

Usage: {{Flag4|country|companion text (optional)}}

Examples:

  • {{flag4|us|United States}}
  • {{flag4|Australia|Aussie}}
  • {{flag4|Canada|Canadian}}
  • {{flag4|Egypt|Egypt}}
  • {{flag4|Greece|Greece}}
  • {{flag4|Italy|ITA}}
  • {{flag4|Luxembourg|LUX}}
  • {{flag4|Peru|Peru}}
  • {{flag4|Thailand|Thailand}}
  • {{flag4|Turkey|The Republic of Turkey}}
  • {{flag4|Zimbabwe|Zimbabwe}}
  • {{flag4|Earth|Mother Earth}}
  • {{flag4|us|}} {{flag4|Australia|}} {{flag4|Canada|}} {{flag4|Egypt|}} {{flag4|Greece|}} {{flag4|Italy|}} {{flag4|Luxembourg|}} {{flag4|Peru|}} {{flag4|Thailand|}} {{flag4|Turkey|}} {{flag4|Zimbabwe|}} {{flag4|Earth|}}

Finding flag images edit

Note to people working on this:

Future development edit

I am using the template array technology. There are proposed technologies which may be better. (SEWilco 05:46, 9 Jun 2005 (UTC))