Wikipedia:WikiProject Flag Template/Archive1
From Wikipedia, the free encyclopedia
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:
- {{flag|USA-48}}: Template:Country data USA-48 — the 48-star flag of the United States.
- {{flag|USA-MN}}: Template:Country data USA-MN — the USA state of Minnesota.
- {{flag|Russian-SFSR}}: Template:Country data Russian-SFSR — Flag of Russia while member of USSR.
- {{flag|Brazil-imperial}}: Template:Country data Brazil-imperial — Imperial flag of Brazil.
- {{flag|Brazil-1889}}: Template:Country data Brazil-1889 — The temporary flag of Brazil for 5 days in 1889.
- Shortcuts:
- 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:
- 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.
- 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.
- Templates {{flagIOC-2000}}, {{flagIOC-2002}}, and {{flagIOC-2004}} exist.
- Use modified country codes such as RUS-SFSR for historical references to Games where a country's reference has changed (ie, different flag).
- An IOC country code should be used only for general reference to that country's Olympic activities.
- IOC country code usage:
Contents |
[edit] Template: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.
- At present, all supported countries must have sub-templates. Need better incantation or create templates.
- 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)
- Uses sub-templates to alias various names for a country to a specific name.
Names supported during testing:
- none
- AUS
- Australia
- AUT
- Austria
- Belgium
- Canada
- Earth
- Greece
- ITA
- Italy
- POL
- Poland
- Turkey
- US
- USA
- United States
- United States of America
[edit] Implementation
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.
- Types presently defined:
- (omitted): country_alias_ has the name of the Wikipedia article for the country.
- flag: country_flag_alias_ has name of country's flag image.
- flagIOC: country_flagIOC_alias_ has name of current Olympic flag image.
- flagIOC-YEAR: country_flagIOC-YEAR_alias_ has name of Olympic flag image for specified year (used for historical references to a specific Olympic Games).
- label: country_label_alias_ has a short text label (generally an ISO three-letter abbreviation).
- flag_ISO: country_flag_ISO_alias_ has name of current flag image, referenced only by ISO 3166-1/USA FIPS 104-1 country codes.
- ISO: country_ISO_alias_ has name of Wikipedia article, referenced only by ISO 3166-1/USA FIPS 104-1 country codes.
- shortname: country_shortname_alias_ has a short common name, such as "United States" instead of "United States of America".
- Types presently defined:
- _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.
[edit] Aliasing example
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: |
US | country_label_alias_US | USA | Small text label: |
US | country_shortname_alias_US | United States | Short country name: |
[edit] Old proposal: Template:Flag2
- Summary: {{flag2}} requires 3 parameters:
- name of flag file and template appends _flag_large.png.
- Wikipedia article name
- 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: Template:Country data Us Problem when 3 parameter not defined
- Example of template usage: Template:Country data Us
- Example of template usage: Japan
- Example of template usage: 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)
[edit] Old proposal: Template:Flag4
- Summary: {{flag4}} requires 3 parameters:
- name of flag file and template appends _flag_large.png.
- Parameter 1 is also assumed to be the link to a Wikipedia article.
- Text with which to label link to WP article.
- name of flag file and template appends _flag_large.png.
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:
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4
- Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4 Template:Flag4
[edit] Finding flag images
Note to people working on this:
- Most flags use Template:PD-flag and thus that page's "What links here" page will show file names. (SEWilco)
- Searches by name can also be done in Special:Imagelist. (SEWilco)
- Wikipedia Commons: commons:Category:National flags. (SEWilco)
[edit] Future development
I am using the template array technology. There are proposed technologies which may be better. (SEWilco 05:46, 9 Jun 2005 (UTC))
- Wikipedia:Category - If templates could use categories, aliases might use them.
- m:Extended template syntax - More flexible template features.
- m:Field-value pairs - Additional data in articles.
- m:Flexible Fields for MediaWiki - Additional data in articles.