Wikipedia talk:WikiProject Flag Template

From Wikipedia, the free encyclopedia

Archive
Archives

Contents

[edit] 11 December 2006 icons broken

If you notice that flag icons have vanished, it may be because User:Centrx has edited a protected template which is part of the flag icon tools. Some flag icons have been broken. The user claims there was discussion in numerous forums, although apparently not here. (SEWilco 18:36, 11 December 2006 (UTC))

The change has been reverted. (SEWilco 19:24, 11 December 2006 (UTC))

So when is this template mess going to be fixed? There are four layers of these templates, starting from the level of {{USA}}; this is not necessary to be within template expansion limits. —Centrxtalk • 09:24, 20 December 2006 (UTC)

Could you explain: "this is not necessary to be within template expansion limits". I don't understand that part. --Ligulem 12:12, 20 December 2006 (UTC)
See #Major code cleanup request. A reason for needing templates within templates is that there cannot be more than 2MB of templates on a page (though to me this seems like a limit that could never be reached with a reasonable use of flags on an article). This limit, however, would only require one level of templates within templates, not three. —Centrxtalk • 02:04, 24 December 2006 (UTC)
Replacing this template system with some fat switch(es) would be a bad idea (see Sherool's post further up). The current system is complex but technically effective and quite efficient, especially with regards to Wikipedia:Template limits. It is also extensible, which switches aren't (you can add new templates – with a switch you have to edit the template containing the switch and adding cases). The vandalism problem that comes with having many templates can be addressed by protecting. The complexity by documenting/explaining. --Ligulem 00:41, 25 December 2006 (UTC)
A "fix" requires a technology which you find acceptable. Maybe someone is working on the "data" concept which Jimbo mentioned over a year ago. (SEWilco 16:50, 20 December 2006 (UTC))

[edit] Ideas for reworking

(Inserted section title "Ideas for reworking" right above --Ligulem 09:44, 4 January 2007 (UTC))
  • Given that these templates are sometimes called hundreds of times on a single page I agree that converting to a few switches (or indeed just one large template) would quickly exceed the 2MB transclusion limit. However, another possibility occurs to me. Currently the 'AUS' template calls 'Country alias AUS' to set "Australia", 'Country flag alias AUS' to set "Flag of Australia.svg" and 'Country label alias AUS' to set... "AUS". Plus a couple of intermediate templates to define the format of the final output. Why couldn't 'AUS' instead set the parameters 'name=Australia', 'flag=Flag of Australia.svg', and 'label=AUS' and just pass those to the format template? The total transcluded size is virtually the same (indeed, possibly smaller since the parameter names are shorter than the template names), but we've removed three extra templates for every country. A ridiculous amount of work to do, but it would vastly decrease the number of templates involved. The only other options are to use fewer flags on a page (in which case the #switch method would be workable) or, as Ligulem said, someone has to track down and protect all of these templates. --CBD 00:49, 3 January 2007 (UTC)
  • Could you please post the exact new code you propose and the name of the template this code is for? I would like to know the details before trying to understand and commenting. Thanks :-). Per the protecting: see my admin log. I've worked through them a bit by starting from main page links and using the new transcluded protection status display feature (bugzilla:8392). --Ligulem 10:18, 3 January 2007 (UTC)
  • See Template:Xyzistan for an example of how the method I describe would work. That calls an 'action' template (just as Template:Country does) which currently defaults to User:CBDunkerson/Sandbox4... which is a reworking of Template:Country_flagcountry designed to work with supplied parameters. If the 'Xyzistan' template were called with an 'action=flag' parameter set then another template, parallel to Template:Country_flag, would be called and so on for the various options supported by the current template... I only built the one example for now. If different aliases were desired a Template:XYZ or Template:Democratic Republic of Xyzistan could be set up the same way or as just a redirect to 'Xyzistan'. Basically this works the same as the current setup except all of the 'Country alias', 'Country flag alias', 'Country label alias', and 'Country shortname alias' templates are removed and replaced by parameters in the top level templates... which also combine the functionality of things like Template:USA and Template:Country. Roughly the same transcluded size... just ALOT fewer templates. Easily less than 25% of what the current system requires. --CBD 01:25, 4 January 2007 (UTC)

CBD, I'm still in the phase of "need to understand more". What I don't see from your proposal is, what should for example happen to template:flagicon. I once did a dissection for the call "{{flagicon|USA}}", which goes like this:

{{#if: {{{1|<noinclude>-</noinclude>}}} |
{{country_flagicon|{{{1}}}|size={{{size|}}}}}
}}

So "{{flagicon|USA}}" (Flag of United States) is

{{#if: USA |
{{country_flagicon|USA|size={{{size|}}}}}
}}

which is the same as

{{country_flagicon|USA|size=}}
[[Image:{{country flag alias {{{1}}}}}|{{#if:{{{size|}}}|{{{size}}}|22x20px}}|{{country alias {{{1}}}}}]]

So "{{country_flagicon|USA|size=}}" is

[[Image:{{country flag alias USA}}|{{#if:||22x20px}}|{{country alias USA}}]]

which is the same as

[[Image:{{country flag alias USA}}|22x20px|{{country alias USA}}]]
  • template:country flag alias USA is "Flag of the United States.svg"
  • template:country alias USA is "United States"

So "[[Image:{{country flag alias USA}}|22x20px|{{country alias USA}}]]" is

[[Image:Flag of the United States.svg|22x20px|United States]]

--Ligulem 10:08, 4 January 2007 (UTC)

BTW, what I don't understand from this dissection is: what's the purpose of "|United States" in "[[Image:Flag of the United States.svg|22x20px|United States]]", which comes from "|{{country alias {{{1}}}}}" in template:country_flagicon? Could that part of template:country_flagicon not simply be removed, thereby eliminating the dependency from template:flagicon to the country alias X templates? --Ligulem 10:27, 4 January 2007 (UTC)
Stupid me: this is the caption text supplied for the image's alt attribute (per Wikipedia:Extended image syntax#Syntax for images with no automatic caption or formatting). Apologies for posting before researching... --Ligulem 10:42, 4 January 2007 (UTC)
BTW 2: template:country_flagicon uses only parameters {{{1}}} and {{{size}}}. What is the purpose for template:flagicon feeding parameter {{{2}}} with the same value as {{{1}}} to template:country_flagicon? --Ligulem 10:52, 4 January 2007 (UTC) I've changed the template and adjusted my dissection above. --Ligulem 16:47, 4 January 2007 (UTC)
Ok, to answer your last question first... I agree that the '2' parameter doesn't do anything on 'flagicon' and expect that it was copied from similar variants where the flag image is followed by an abbreviation code. I've noticed a few little things like that which could be 'tightened up' in the current system.
As to the change I am proposing... instead of a call to {{flagicon|USA}} the user would now invoke {{USA|action=flagicon}}. The 'USA' template would be the same layout as my 'Xyzistan' template above (or a redirect to such a template). It would thus look something like;
{{{{{action|User:CBDunkerson/Sandbox4}}}
|flag=Flag of the United States.svg
|size={{{size|22x20px}}}
|alias=United States
|name=United States
|shortname=United States
|label=USA}}
I think some of the whole alias/name/shortname redundancy can probably be removed, but I haven't analyzed all the sub-templates yet to verify that. The 'action' and other named parameters could also probably be changed to just '1', '2', '3', et cetera to simplify and shorten the template calls. Anyway, since 'action' (or '1') is set to 'flagicon' in this case we would call a 'flagicon' template... which would be essentially the same as the current Template:Country_flagicon except that it would take the 'flag' and other parameters above instead of looking up the contents of template:country flag alias USA and the like... just as User:CBDunkerson/Sandbox4 is a reworking of Template:Country_flagcountry to use the parameters rather than sub-templates. Thus, under the proposed system each of the 'Template:Country_<action>' templates would be rewritten to accept parameters instead of looking up sub-templates. We could probably even keep the same template names and temporarily recode them to accept either format to make the transition easier. --CBD 12:47, 4 January 2007 (UTC)
Thanks. Ok. So your point is that flagicon wouldn't be used anymore.... So your idea is to package all data about "USA" into a single data template called "USA" that can be combined with a set of "data using" or "action" templates. Not bad (this is a recurring template pattern [1] :-). Give me some more time to ruminate this. One point: I do have a bit a strange feeling about the "size" parameter in your USA data template. This is a "feed through" to the action template as I understand it. So the default value "22x20px" should be in the specific "action" template not in the data template (?). Maybe we can find some better way on this corner. Need to think about this more... --Ligulem 13:26, 4 January 2007 (UTC)
Just for the record: The current system does have the advantage, that if new "actions" that require additional data-parameters (lines in CBD's "USA" template) are added, these parameter values can be added to the wiki by just creating additional templates (containing these values alone). So the existing system is "better" with regards to extensibility. With CBD's "all data per country in one template" approach, all data templates must be changed (example: say we create a new action that requires a "population" parameter. "population" would have to be added on all USA, etc. templates). However that's exactly one of the drawbacks of the current system as well: an abundance of templates. Sigh. --Ligulem 13:43, 4 January 2007 (UTC)
Well, the 'flagicon' template could be kept and just changed around to call the appropriate 'country specific' template with 'flagicon' as the 'action' parameter. That'd allow backwards compatibility with existing links, but be rather redundant... though actually having both 'flagicon' and 'country' currently is similarly redundant. As to '22x20px'... it needs to be set in the top level parameter to avoid being blanked out. That is, if the user did not set a 'size' parameter then Template:Xyzistan would set parameter size to blank... which is not the same as unset. The lower level templates would then use that 'blank' value and ignore the default since a 'value' (of 'blank') WAS set. Finally, on extensibility... having to add one new 'population' template for each alias of each country would probably be about as much work as adding a 'population' parameter to each existing template for each non-redirect alias of each country. The only way to get rid of THAT 'mass edits to add new feature' problem would be to go to a 'switch' based system. --CBD 14:08, 4 January 2007 (UTC)

Quick stupid question: If I look at the articles, I see all these small icons. So most uses of this template system here is displaying a small flag icon on an article page. So what do we need to know to display such a small icon? We need a common size and the name of the image for the flag and the alt text. So why don't we simply create a template:smallflag Italy, containing:

[[Image:Flag of Italy.svg|{{smallflagsize}}|Flag of Italy]]

and a template:smallflagsize containing "22x20px" and replace the current calls on articles for small flags? I bet this would cover 90% of current usage taking load off this current system. --Ligulem 14:23, 4 January 2007 (UTC)

Something like that would be fine with me. People would have to manually create their Italy and ITA links... resulting in those and the image caption text not always being consistent or correctly disambiguated, but not TOO big a deal. Even some of that could be dealt with by putting one or two options into the template to display the links. All of the complexity of the current system comes from standardized formatting for several different display options... if that was all or mostly handled manually it'd be alot simpler. BTW, the 'smallflagsize' template wouldn't really be needed in the example above... just code the 22x20px into the 'smallflag Italy' template directly. --CBD 00:05, 5 January 2007 (UTC)
You've worked your way back to the hardcoded templates for each abbreviation which existed before these the flag templates existed. Did you read the original Village pump discussion? It is archived on this page.[2] Changing the size would then require that all the hardcoded templates be identified and edited; the size already had to be adjusted once in the templates. (SEWilco 03:48, 5 January 2007 (UTC))
If global size changes are a desired capability then Ligulem's idea of a separate 'smallflagsize' template for just that value would probably be the best way to go. I think it is really a matter of determining what capabilities are desired / most needed. I would describe the scope of the current system as 'four templates or redirects per country alias plus two templates per display configuration'. I have been suggesting that the same capabilities could be achieved with 'one template or redirect per country alias plus one template per display configuration'. Ligulem took out all the text formatting options to get it down to 'one template or redirect per country alias plus one image size template'. For either of the latter two options the big gain is in losing the multiple templates for each alias. I think that would be much more managable. The only way to reduce it further would be to force users to always call the template with the same alias or add big 'switch' statements that would cause problems with mass transclusions. --CBD 09:56, 5 January 2007 (UTC)
SEWilco, I've read that discussion now. The current system is technically ingenious and its not bad for the servers (as long as we don't have a massive vandal attack editing all templates within the same few minutes). Thing is, people do have problems to understand the current system and three or four times 1'500 templates for 1'500 flags is a lot. However, I don't think we should try to reduce the number of templates at all cost. Per CBD's "data" template: I've thought about this and slept a night over it. The more I think of it the more bad feeling I have about it. CBD's USA example above here is rather complicated as well (compared to the existing system). The problem I think I'm able to articulate at the moment about it is, that I fear it is difficult for people to maintain all 1'500 data templates consistent (we currently have about 1'500 different flags in the current system [3]). Also, as already noted, I'm especially not pleased about the size handling in CBD's data template. Per the "quick stupid" proposal by me, that was a radical attempt at a minimalistic solution. Maybe we could include a size parameter to make it a little bit more versatile:
[[Image:Flag of Italy.svg|{{{size| {{smallflagsize}} }}}|Flag of Italy]]
But then, we start having the same "keep it consistent over 1500 templates" problem again. People will copy these templates when they want a new flag. If someone introduces a slight variant of that, uniformity is lost again. Today, people copy things like template:USA which currently is {{country|flagcountry|United States}} and they get redlinks for the missing data templates and fill the missing data in (Demonstration: throwaway Template:LigulemLand, which shows the redlinks for the missing templates). Besides creating 4 templates for a single flag ({{LigulemLand}}, {{Country flag alias LigulemLand}}, {{Country alias LigulemLand}} and {{Country shortname alias LigulemLand}}), a good solution to keep everything consistent, including the names of the created templates. In short: I'm not sure what to do with the current system. --Ligulem 10:52, 5 January 2007 (UTC)
Or when they create a new flag they fill in the missing data in countryedit. (SEWilco 21:49, 5 January 2007 (UTC))

Template:Countryedit is deprecated. Please instead use the templates listed at Category:Country data templates, such as Template:Country data USA. See also Wikipedia:WikiProject Flag Template

Ahh. Ok. A factory tool for creating new flags. Nice technical solution. --Ligulem 00:45, 6 January 2007 (UTC)
I'm not sure I see the consistency problem. If the top level template JUST passes parameters to another template then when people copy that to a new country any 'changes' they make would have to be outside the template call (which is possible under any structure) OR would require updates to the sub-template... which is shared by all the other countries and thus any changes to it will be reflected in the others and can be reviewed for consistency / consensus. If all the formatting code were in the top level as per your suggestion then each template could be formatted independently. The 'size handling' can be done with a sub-template in ANY of the systems (including the current one) if that is preferred. Finally, after looking at the various 'action' formats I'm thinking that it might be possible to build a fairly compact single sub-template to handle all of them... which would mean one template/redirect per country alias and then just one other template for setting the default size and formatting the output. Only problem would be keeping it small enough to allow mass transclusion, but I think it is doable. --CBD 11:40, 5 January 2007 (UTC)
I was thinking about errors like "|shortnam=United States" instead of "|shortname=United States" or missing parameters because someone deleted it and somone else copied the error. Whatever. The default size should not be hardcoded, so at least let's have:
{{{{{action|User:CBDunkerson/Sandbox4}}}
|flag=Flag of the United States.svg
|size={{{size|{{defaultflagsize}} }}}
|alias=United States
|name=United States
|shortname=United States
|label=USA}}
or something (I don't care about the name of the templates). Maybe a test implementation could help to gather some real experience? For example, we could copy European Union to Wikipedia:WikiProject Flag Template/tests/European Union and implement the flags for that page using CBD's data/action template system (duly marking the new templates as not released for general use on articles yet). --Ligulem 12:48, 5 January 2007 (UTC)
A while ago, Jimbo Wales wanted a data tool which could store information such as the capitol of a country. Anyone know if something (Wikidata/WikiTextrose?) is close to going live? (SEWilco 21:53, 5 January 2007 (UTC))
I haven't heard anything, but I doubt it is coming any time soon. Single logon and stable versions are the two big projects currently in the pipeline. --CBD 23:08, 5 January 2007 (UTC)

[edit] Sub-templates

Currently this system can access the following 'action' subtemplates:

  1. codeISO - Virtually unused. Output format = 'XYZ'
  2. flagISO - Virtually unused. Output format = Xyzistan XYZ
  3. flagIOC - Virtually unused. Output format = Xyzistan at the 2004 Summer Olympics XYZ
  4. flag - Output format = Xyzistan XYZ (optional 'name' parameter to change link display)
  5. flagcountry - Output format = Flag of Xyzistan Xyzistan (optional 'name' parameter to change link display)
  6. flagcountrycat - Virtually unused. Output format = Same as above plus adds to Category Xyzistan (optional 'name' parameter to change sort key)
  7. flagicon - Output format = Xyzistan
  8. infobox - Virtually unused. Small table with 'data' subtemplates that do not appear to have been created.
  9. name - Virtually unused. Output format = Xyzistan

Leaving out the six options that aren't really used that leaves 'flag', 'flagcountry' and 'flagicon'. The only differences between these are that 'flagicon' does not provide a link to the country article, 'flagcountry' uses the image tooltip 'Flag of <place>' rather than just '<place>', and 'flag' displays the abbreviation (e.g. 'XYZ') by default instead of the name (e.g. 'Xyzistan') on the link. I'm assuming that the inconsistency on the image tooltip isn't intentional/relevant and the only real formatting variation here is the link to the country article at the end... either don't show it, default the text to 'XYZ', or default the text to 'Xyzistan'. All of which could easily be handled with a single parameter. --CBD 13:07, 5 January 2007 (UTC)

Many thanks for the list. Per the "image tooltip": this is the "alt" parameter for the <img> html element, which is useful for users that turn off pictures in their browsers or for users that use a screen reader like user:Graham87. For example, reading "Flag of Italy" as the alt text makes probably more sense than just "Italy". --Ligulem 13:21, 5 January 2007 (UTC)
Ok, I put the tooltip in with 'Flag of', combined it all in to one template (Currently at User:CBDunkerson/Sandbox4), and set up my fictional country of 'Xyzistan' as a test case:
  1. {{XYZ}} = Template:XYZ
  2. {{XYZ|icon|size=30px}} = Template:Xyzistan
  3. {{Xyzistan|label}} = Template:Xyzistan
  4. {{Xyzistan|Democratic Republic of Xyzistan}} = Template:Xyzistan
The final template at User:CBDunkerson/Sandbox4 is still fairly compact. I didn't create a separate 'smallflagsize' template because the size is now set only in this single template for all uses. Thoughts? --CBD 13:53, 5 January 2007 (UTC)
Off topic: I think I'm signing off here and leave this to the real experts. Cheers, --Ligulem 14:39, 5 January 2007 (UTC)
I've been bold and put this into practice as Template:Flag icon and converted Template:USA (probably the most widely used example of the present system) to call that. The transcluded size in this case is actually smaller and the system requires transclusion of two templates instead of six. The only significant 'drawback' (other than the work needed to retool everything) I see is that things like Template:United States are already in use. However, if we settled on a standard of making the base template the three letter ISO code (almost all of which seem to have templates in the existing system) and convert all other existing 'aliases' to a format of '<alias> flag' (e.g. Template:United States flag) as redirects to the default three letter code then I think this should be workable. --CBD 15:07, 5 January 2007 (UTC)
Duh. Ok. Just noting that after the first call of {{flagicon|USA}} has been changed to {{USA|icon}} (and we don't know if that already has happened somewhere by the time I write this), your edit to template:USA can no longer be reverted without breaking articles. Let me know if I shall fire up my MWB... (awaiting consensus). --Ligulem 16:58, 5 January 2007 (UTC)
Somehow I'm not too worried. After all, other than people who have been following this thread who exactly would even think/know to DO that? As the output is identical, chances are that no one else has even noticed the change yet. I'm tempted to just go ahead and convert all variants of the U.S. flag over, but waiting on any comments about potential drawbacks to this system. --CBD 20:21, 5 January 2007 (UTC)
Conflicts such as {{United States}} were referred to in the original Village Pump discussion, and is why the "flag" and "country_" prefixes were selected. It's just not safe to restrict the name of a country to being a magic word. (SEWilco 06:46, 6 January 2007 (UTC))

[edit] Template:flag icon comparison

So by using the changed template:USA, which uses the new template:flag icon (note the space), we could now do:

New call Old call(s) Remarks
{{USA}} = Flag of United States United States (unchanged) {{USA}} = Flag of United States United States

{{country|flagcountry|USA}} = Flag of United States United States

{{USA|icon}} = Flag of United States United States {{flagicon|USA}} = Flag of United States
{{USA|icon|size=40px}} = Flag of United States United States {{flagicon|USA|size=40px}} = Flag of United States
{{USA|label}} = Flag of United States United States {{country|flag|USA}} = Flag of United States USA
{{USA|Some special link text}} = Flag of United States United States {{country|flagcountry|USA|name=Some special link text}} = Flag of United States Some special link text

Feel free to edit the above table. --Ligulem 23:47, 5 January 2007 (UTC)

  • Why the two references in the first row to {{USA}}? (SEWilco 03:51, 6 January 2007 (UTC))
  • I'd guess that this was meant to represent that 'USA' was also a working template under the current system before being changed over. --CBD 09:23, 7 January 2007 (UTC)
  • An invariant. Calls {{USA}} wouldn't have to be changed under CBD's system. Maybe I simply shouldn't have added this row :-). Sorry for the confusion. --Ligulem 09:55, 7 January 2007 (UTC)
Above I changed "flagcountry|United States" to "flagcountry|USA" so all the same name are used. (SEWilco 03:51, 6 January 2007 (UTC))

Let's try another one. (SEWilco 03:51, 6 January 2007 (UTC))

New call Old call(s) Remarks
{{United States of America flag}} = Flag of United States United States {{United States of America}} = Template:United States of America

{{country|flagcountry|United States of America}} = Flag of United States United States

{{United States of America flag|icon}} = Flag of United States United States {{flagicon|United States of America}} = Flag of United States
{{United States of America flag|icon|size=40px}} = Flag of United States United States {{flagicon|United States of America|size=40px}} = Flag of United States
{{United States of America flag|label}} = Flag of United States United States {{country|flag|United States of America}} = Flag of United States United States of America
{{United States of America flag|Some special link text}} = Flag of United States United States {{country|flagcountry|United States of America|name=Some special link text}} = Flag of United States Some special link text

Let's try {{United States}} all by itself. (SEWilco 03:53, 6 January 2007 (UTC))

Flag of the United States
Political divisions of United States
Federal district

District of Columbia

States

Alabama | Alaska | Arizona | Arkansas | California | Colorado | Connecticut | Delaware | Florida | Georgia | Hawaii | Idaho | Illinois | Indiana | Iowa | Kansas | Kentucky | Louisiana | Maine | Maryland | Massachusetts | Michigan | Minnesota | Mississippi | Missouri | Montana | Nebraska | Nevada | New Hampshire | New Jersey | New Mexico | New York | North Carolina | North Dakota | Ohio | Oklahoma | Oregon | Pennsylvania | Rhode Island | South Carolina | South Dakota | Tennessee | Texas | Utah | Vermont | Virginia | Washington | West Virginia | Wisconsin | Wyoming

Insular areas

American Samoa | Guam | Northern Mariana Islands | Puerto Rico | U.S. Virgin Islands

Minor outlying islands

Baker Island | Howland Island | Jarvis Island | Johnston Atoll | Kingman Reef | Midway Atoll | Navassa Island | Palmyra Atoll | Wake Island



Hmm. CBD's data templates can be named to "SOME PREFIX XXX". For example "Flagdata USA". BTW the current system didn't stop people from using template:USA. The "discrepancy" template:USA / template:United States already exists now. I assume people won't stop using that. As I understand it, template:USA isn't even a part of SEWilco's flag template system, so changing template:USA and adding template:flag icon doesn't touch SEWilco's flag template system. But I admit, replacing calls {{flagicon|USA}} with {{USA|icon}} would, and this would introduce more calls into the naming discrepancy SEWilco is criticizing and which his system solves. Couldn't that problem on the CBD system be addressed by using template:Flagdata USA and creating a front end template:flagicon2 or something? (Don't bite me about this naming, we could copy the contents of the recently created template:flag icon to template:flag icon formatter and then reuse the name "flag icon" for the CBD front end. So the updated replacement would then be:
CBD style call: {{flag icon|USA}}, which replaces the SEWilco style call: {{flagicon|USA}}. --Ligulem 08:44, 6 January 2007 (UTC)
SEWilco, ONLY the 'USA' template has been set up in the new format... ergo, of course the examples above do not do anything yet. However, there is nothing preventing us from setting those up... which would be one template for each alias instead of the current three or four. As I said previously, the problem with some of the templates, like 'United States', currently being in use could be fixed the same way it is in the current system... by using something like 'United States flag' as the standard name. If we always add 'flag' to the end (or front, or some other term) then there should not be much overlap. On the existing 'flagicon' template... when all the countries are set up that could just be re-coded to call the new 'flag icon' template with the parameters in the right place... all of the existing calls to 'flagicon' could be left completely unchanged. --CBD 11:13, 6 January 2007 (UTC)
Just a minor point: If we use common prefixes instead of suffixes (for example "Flagdata United States" instead of "United States flag)", listing all templates would be easier. For example, if we would use the common prefix "Flagdata" – as in template:Flagdata USA – listing all flag data templates could be done by using Special:Prefixindex with this query. This would be closer to the style of SEWilco's current system. Of course, a suffix naming system can as well be enumerated by adding the templates to a category. Another even smaller point is that templates using the same prefix are listed together in the edit mode of an article. See the list of transcluded pages here. --Ligulem 12:56, 6 January 2007 (UTC)
Makes sense. I was going with the suffix because "United States flag" sounds ok as a name. On prefixes, I'd prefer to keep it short given that this would be something the user has to type in for each call... {{flagdata United States}} would work, but is there a reason not to use {{flag United States}}? Of course, if we keep the 'multiple entry points' of the current system's Template:Country, Template:Flagicon, Template:Flag, et cetera then the prefix could be automatically add in the code of those (see other comment below for more info on this). --CBD 09:33, 7 January 2007 (UTC)
I added a Template:United States of America flag redirect to Template:USA and updated the table above to show how this is intended to work. The 'United States' template would instead be Template:United States flag. There is no problem of 'name overlap' here... the same system of using prefixes/suffixes employed by the current system works just as well for the proposed. --CBD 11:37, 6 January 2007 (UTC)
I'm not sure I understand the need for Template:Flagdata United States, etc. I'm of the opinion that we create templates such as Template:USA that calls on Template:Flag icon, and leave it at that. The reason we're revisiting the issue is that the list of transcluded templates is already extremely long and the current system is too complicated. Adding redirects for every country, and essentially creating more work and a more complex system seems contrary to the goals of these discussions. I know some people are concerned about usability, people are smart enough to figure out that all flags are using a three-letter, and when they try to use something different, it obviously won't work. There could a nicely laid-out directory of the templates, and that would enable everyone to look up what template to use. Template redirects make things more complicated, and they make the list of transcluded templates longer. --MZMcBride 20:48, 6 January 2007 (UTC)
SEWilco can probably better explain the motivation behind the current naming system. But if you look at this section of Andre Agassi, you'll see calls of {{flagicon|USA}}. These would have to be replaced by {{USA|icon}} using CBD's pure proposal. Now that's fine, because template:USA is already in use as a flag template and can be reused for CBD's system because the existing parameterless calls {{USA}} are compatible with CBD's version of the template. Thing is, there is no uniform naming system when using the "direct" templates like template:USA. So it could be that you would have to replace the fictive {{flagicon|Ligulemland}} with {{Ligulemland something|icon}} if fictive template:Ligulemland happens to have already been taken for a list of the fast food restaurants. This is the case for template:United States, which was already taken for a navigation box. The example of United States is somewhat lame as template:USA can be used instead. One of the reasons for the current admittedly difficult to understand system is – as I understand it – to also provide some uniform naming system. So I guess it was probably the original intent to replace calls to template:USA with {{country|flagcountry|USA}} or at least provide {{country|flagcountry|United States}} for the already lost template:United States (a navigation box). I hope this makes some sense. Apologies if I might have increased the confusion. --Ligulem 01:00, 7 January 2007 (UTC)
You're repeating the process which created the flag templates. The USA template (history) existed before it used the flag templates. The existence of the numerous differing flag definitions caused problems. The "country_" prefix was chosen for the data template array for the same reason you realized, so as to group them together alphabetically. The different aliases for countries were created because this is an editor's tool and editors can't be expected to remember the proper incantations for all countries so they have some common choices. If people want to replace {{USA}} with a more formal tool that's their choice; I am not aware of anyone examining whether {{USA}} is obsolete or not. This flag project specifically states that better technology is expected to replace this mess, and I consider Flagicon|USA to be a marker for future replacement by the better tool. Examine the characteristics of this tool and figure out if you're talking about a better tool. (SEWilco 03:01, 7 January 2007 (UTC))
On the matter of converting {{flagicon|USA}} calls to {{USA|icon}}... again, that wouldn't really be required if we didn't want to do it. Once all the templates and redirects were set up the 'code' of Template:flagicon could be retooled to something like {{flagdata {{{1}}}|size={{{size|}}}}}... allowing all the existing calls to continue working. It'd mean an extra template transcluded for those calls, but still have less of that than the current system. --CBD 09:33, 7 January 2007 (UTC)


[edit] Format template

Instead of thinking of a 'smallflagsize' template, consider thinking of a 'flagformat' template. It might have only the size, but it might have other flag format fields. A common use of templates is consistent formatting, and perhaps the formatting can be defined in one place. (SEWilco 21:40, 5 January 2007 (UTC))

See Template:Flag icon... which is exactly what you describe above; a single template for all the formatting options covered by the current structure. Examples of its use can be seen in the section immediately above with the various 'Xyzistan' links. --CBD 23:08, 5 January 2007 (UTC)
If we were able to find a way to implement image redirects, either through javascript or a change to MediaWiki, these problems could be eliminated. You could have the standard Image:Flag of Australia.svg, but then also have redirects from Image:Flag of AUS.svg and Image:Flag of Commonwealth of Australia.svg, and all other variants, and then a template could simple use [[Image:Flag of {{{1}}}.svg|22x20px|{{{label|{{{1}}}}}}]] and it would solve the problem of the number of templates altogether. You would have a single template that could be used for any flag. So, are there any thoughts on a way to implement image redirection?
By the way, after reading the discussion above, I think using the system with country codes and having 1500 individual templates is too complicated, and should only be done if there would be a dedicated bot that would watch all of the templates and check for uniformity and be able to change all the templates en masse whenever changes across the flags were desired. --MZMcBride 23:59, 5 January 2007 (UTC)
CBD's template:flag icon would reduce the number of templates from currently three times 1500 (considering the typical usage of the current system) to just 1500. All data for a specific flag would be kept in a single data template (example: template:USA) instead of having three data templates per flag with the current system. The formatting algorithm is stored in a single place at template:flag icon. --Ligulem 00:18, 6 January 2007 (UTC)
OK, that sounds pretty reasonable. Though the image redirection, if ever possible, would really reduce it to one template, which beats 1500 and 1500*3. I've been involved in the discussion on the technical village pump about flag icons, and I'm just looking for any way to reduce the number. So, an implementation of CBD's idea sounds great. --MZMcBride 00:29, 6 January 2007 (UTC)
What is the meaning of the reference of 3*1500? The first mention of 1500 says there are 1500. (SEWilco 03:56, 6 January 2007 (UTC))
Ligulem mentioned that it currently requires about three templates per flag (Country flag alias, etc.) and that 1500 templates would be better than "three times 1500" templates. --MZMcBride 04:05, 6 January 2007 (UTC)
Ah. So if the "image redirection" ever appears, that would replace perhaps 1500 templates with 1500 image redirections. Minus the 300 or so actual images. (SEWilco 06:39, 6 January 2007 (UTC))
You're "looking for any way to reduce the number". So your only goal is a smaller number. Which features are you willing to sacrifice? (SEWilco 06:51, 6 January 2007 (UTC))
If we can reduce the number of templates, that would be fine. I don't think we need to "sacrifice" much. Can't we have one data template instead of three (or more) per flag? --Ligulem 08:50, 6 January 2007 (UTC)
Well, which of the features of the current system do you want to keep and which do you want to change? (SEWilco 03:07, 7 January 2007 (UTC))
CBD's proposal reduces the number of templates and the complexity of the current system. So that's an improvement. So if there aren't any objections against CBD's proposed change, we can implement it as soon as we have consensus. It's as simple as that. What are the features of the current system? Which features would "break" with CBD's simplification? --Ligulem 10:14, 7 January 2007 (UTC)
I don't think anyone was looking to change the features at all. My only goal was to reduce the number of templates transcluded so it'll be easier to do protections/unprotections when articles with these flags appear on the Main page... and so people might stop doing the WP:AUM dance. My position is that I think we can replicate the existing functionality with fewer total templates, fewer templates transcluded per call, and a smaller transclusion 'footprint'. The 'data array' approach was solid, but parserfunctions are a 'new' (relatively) technology which should allow the same capabilities in a more compact form. Still not a 'final' / 'perfect' solution by any means, but possibly worth implementing. --CBD 09:42, 7 January 2007 (UTC)
SEWilco, the whole thing could be done as a single template for all countries with a big 'switch' statement, but that would impose a lower limit on the number of flags per page so we didn't do that. Which features do you think are sacrificed by the proposed system? I tried to set it up so that it can retain all the existing capabilities... and even all the existing template calls in the articles if we don't want to convert those. --CBD 11:26, 6 January 2007 (UTC)

[edit] Changing USA flag calls

Ok. So now we have CBD's template:USA as discussed above. Can we now put this into use on the articles and go orphanning Template:Country alias USA, Template:Country alias United States, Template:Country flag alias USA, Template:Country flag alias United States, and Template:Country shortname alias USA for a start? Can we now replace the calls as shown in the table below?

New call Old call
{{USA|icon}} = Flag of United States United States {{flagicon|USA}} = Flag of United States
{{USA|icon|size=40px}} = Flag of United States United States {{flagicon|USA|size=40px}} = Flag of United States
{{USA|label}} = Flag of United States United States {{country|flag|USA}} = Flag of United States USA
{{USA|Some special link text}} = Flag of United States United States {{country|flagcountry|USA|name=Some special link text}} = Flag of United States Some special link text

I say yes. The new system uses less templates and reduces the complexity. Any objections to put this into use for the USA flag now? I'm volunteering to do this, with the help of my WP:AWB fork (no bot run, manually checking every diff before saving). --Ligulem 10:38, 7 January 2007 (UTC)

What are you proposing? First list which features of the current system you're willing to keep and which you're willing to get rid of. (SEWilco 16:45, 7 January 2007 (UTC))
This is a trap question right? I think my proposal is clear. And the motivation has been discussed. --Ligulem 17:11, 7 January 2007 (UTC)
To give a specific example: on Andre Agassi, I would replace all calls of {{flagicon|USA}} with {{USA|icon}} (sandbox edit). The resulting page would no longer use Template:Country alias USA and Template:Country flag alias USA. It would instead use template:USA and template:flag icon. The latter would be shared as soon as other flags have been converted. But I'm only asking for USA at the moment. As a first step. --Ligulem 17:37, 7 January 2007 (UTC)
No, it is not clear what you are proposing. The announcement which you put on several templates does not make clear that you are only referring to the "USA" usage, as opposed to using "USA" as an example of a template call.[4] [5] [6] In order to orphan Template:Country flag alias United States you'll also replace things like {{flagicon|United States}}, requiring "USA" for all calls. You also aren't listing which features of the current system you'll affect and which you won't affect. Perhaps you should ask in the talk pages of Andre Agassi and several other pages which you'll affect. Such as Chicago Cubs, Formula One, List of terrorist incidents, Organization of American States, Tour de France, United Nations Security Council. (SEWilco 19:30, 7 January 2007 (UTC))
Again... so far as I can see all currently used features will be supported. If there is some capability you think isn't covered by Template:Flag icon please say what it is and we can look at it. If you think the current configuration has advantages over the proposed please say what those are and we can discuss them. You mention 'USA' only being allowed, but Ligulem had already proposed 'flagdata United States' (though I might prefer the shorter 'flag United States') for variants other than the three letter codes. Also, again, I think that all current template calls in Andre Agassi and the other pages you list could be left completely unchanged - by redoing {{country}}, {{flagicon}}, {{country flagcountry}}, and so forth as calls to the appropriate country template... basically just a matter of reshuffling the parameters passed in, as demonstrated in one of my previous comments. If Ligulem is offering to do the work of converting them all to direct calls instead I don't see a problem with that, but please indicate what it might be if you do. --CBD 21:37, 7 January 2007 (UTC)
I suspect SEWilco wants to keep the current system without any change. If that's the case, then it would at least be fair to say so. We can then spare us the time argumenting here. The current system can be improved as has been laid out on this talk page. Not improving here is a lost chance in anticipating dissent from other wikipedians. People have already complained about the complexity of the current system. Some of them are also against having flags on the articles. Keeping the current system unchanged is ammunition for them. Best regards, --Ligulem 22:12, 7 January 2007 (UTC)
Nope, I want this to change. I defined these Flag Templates as being temporary until better tools become available. Is this a better tool, when you're still figuring out what is needed? (SEWilco 22:50, 7 January 2007 (UTC))
I'm figuring out what is needed? --Ligulem 23:38, 7 January 2007 (UTC)
I'm withdrawing this in favor of User:Ligulem/work/flag templates rework. See below. --Ligulem 17:57, 10 January 2007 (UTC)

[edit] Template:Country name alias

As I read this discussion, I saw that you where afraid of the include size, thus I checked on the template I made before, and specially it's talk page where the template is used seven times, the result in the source code is:

<!-- 
Pre-expand include size: 62319 bytes
Post-expand include size: 2095 bytes
Template argument size: 424 bytes
Maximum: 2048000 bytes
-->

AzaToth 00:01, 8 January 2007 (UTC)

[edit] Another variant

Hi chaps. I've started hacking on a replacement using the same frontend templates as the current system but using CBD's shared data template idea. See User:Ligulem/work/flag templates rework. Not yet complete (ISO is missing), but isn't this a damn sexy data page? :-) --Ligulem 16:40, 8 January 2007 (UTC)

Whoa. When did they allow recursive parameter substitution so country_data would work? I tried that, and using a variable to invoke a template was specifically forbidden. Where is the limit on recursiveness defined, so we can ensure we won't encounter it? Storing all the country info in one place has always been desirable. And Template:Country data FRA redirects to Template:Country data France so there is only one copy of country data. (SEWilco 19:17, 8 January 2007 (UTC))
You should give a summary of the features (and function for those who are not template programmers). Looks to me like the main feature is that there is a single template with the data for each country (such as country_data_France) which is wrapped within user functions (such as country2) which call country_data_* with parameters which trigger display templates (such as country_flag2). The major features seem to be storage of all country data in one place (which can have country renaming aliases redirected to it), and consistent appearance of the flag icons. Looks like other info, such as the capitol of a country, could also be stored if there is such info which needs this kind of editor access. (SEWilco 19:33, 8 January 2007 (UTC))
Thanks for looking into this. "...for those who are not template programmers" – Man, I always had a hard time to follow what you did on templates. So please don't tell me you are not a template programmer :-). BTW I'm not sure I broke some unwritten rules with what I did (recursive parameter substitution? I didn't notice I used that...), but I don't have a bad feeling. However, some careful examination by the template gurus here might be a good idea. I will try to add the remaining missing features (country|flagISO, country|flagIOC - haven't looked into this yet), so this might then be plugged into current usage on articles by switching calls over from the xxx to xxx2 templates. The new system can be kept in parallel to the existing one, so we could prepare all data templates that are needed for a certain article and switch that article over and then extend this to more articles. BTW feel free to edit in my userspace as you see fit (page moving included). --Ligulem 21:07, 8 January 2007 (UTC)
You need to explain it to those who are reading this and trying to figure out whether they like the new method, without their having to understand every detail. I think I figured it out, which is why I tried to summarize it. So there are basically three template incantations for each call? The invocation, the country_data, and the formatter? The thing I like best is how country_data has all the info, reducing scattering of data (and only that one template has to be retrieved to get all that info). (SEWilco 03:09, 9 January 2007 (UTC))
Ah. Ok. Well, for the templates that editors on articles use, there is no change at all in usage besides adding a "2" to the current name of the template calls (country → country2, flagicon → flagicon2). So the usage documentation of the current systems applies to the new one as well. What's changed is the data template(s). But you're right. Documenting is always a good thing. Thing is, I haven't completely understood all uses of the existing system, I've just refactored it... :-). --Ligulem 09:42, 9 January 2007 (UTC)
...still thinking about the recursion thing. I don't think there is, besides for template page display on Template:Country data France, carefully packaged inside <noinclude>'s
{{ {{{1<noinclude>|country showdata</noinclude>}}} ...
                  ^^^^^^^^^^^^^^^^^
And if someone forgets the <noinclude>'s, the parser won't get mad (I trust Tim :-). --Ligulem 21:18, 8 January 2007 (UTC)
Recursion isn't quite the right word. Template invocation through that variable substitution which you used is something that I'm pretty sure I tried. Well, it works now. If it breaks it will be noticed. (SEWilco 03:09, 9 January 2007 (UTC))
I've implemented flagISO: {{country2|flagISO|FRA}} = Flag of France France. For this, I had to add "ISO alias = France" and "flag ISO alias = Flag of France.svg" to Country data France, which seems a bit redundant (also ditched the "suffix" param for template:Country showdata and introduced "countryname"). Hmmm, is this country2|flagISO needed/used? Anyway, added it for compatibility with the current system. It might be a good occasion now to review this. --Ligulem 00:25, 9 January 2007 (UTC)
Keep in mind that a three letter abbreviation might mean something different, such as in ISO and IOC. Choose the template naming to prevent conflicts, probably with "ISO" or "IOC" inside a template name pattern. (SEWilco 03:17, 9 January 2007 (UTC))
Ok. I just replicated that part ({{country|flagISO|...}}) of the current flag templates. It's in the new system now. Looking at Template:Country data France
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias           = France
| shortname alias = France
| label alias     = FRA
| flag alias      = Flag of France.svg
| ISO alias       = France
| flag ISO alias  = Flag of France.svg
| countryname = {{{countryname|France<!-- MUST MATCH SUFFIX OF PAGENAME!! -->}}}
| size        = {{{size|}}}
| name        = {{{name|}}}
}}
for example "flag ISO alias" and "flag alias" have the same value in this specific data set. I'm asking myself if the call {{country2|flagISO|...}} (formatter template) couldn't co-use "flag alias". Also the description at Wikipedia:WikiProject_Flag_Template#Implementation says:
"country_ISO_alias_ has name of Wikipedia article, referenced only by ISO 3166-1/USA FIPS 104-1 country codes."
and
"country_alias_ has the name of the Wikipedia article for the country."
Also, are there different flags for the country|flagISO needed/used? I don't mind that much, I was just asking this myself while doing the flagISO clause of template:country2.... --Ligulem 09:42, 9 January 2007 (UTC)
I think you need country_ISO_data_FRA because "FRA" may mean something different in ISO, IOC, and whatever other country codes for which support is needed. Otherwise you need "ISO" versions of all the variables, and expect data for several countries within a single country_data_* template. Notice that if "FRA" has the same meaning in ISO and IOC, country_ISO_data_FRA and country_IOC_data_FRA both could redirect to country_data_France. And if the ISO and IOC country identification is done through the _data_ addressing, are "ISO" variables needed? (SEWilco 02:23, 10 January 2007 (UTC))
Did {{country2|flagIOC|..}}, too (formatter, data). What's left? --Ligulem 12:30, 9 January 2007 (UTC)
I dropped the support for IOC per reasoning below at #Olympic flag usage (flagIOC etc.) --Ligulem 11:02, 10 January 2007 (UTC)
See a nice way to handle variants, such as historical flags (USA-48 with 48 stars)? There are some obvious ways to handle U.S. states. (SEWilco 19:45, 10 January 2007 (UTC))
I will have a look. --Ligulem 10:21, 11 January 2007 (UTC)
On another note, you might have seen this, but it wasn't evident in the examples shown at {{Country data France}}, but most of the instances I have come across of flag usage do not use the {{country|action|..}} forms, but usually call {{flagicon}} or {{flagcountry}} directly. I see that you have a test template at {{Flagicon2}}, but the Flagcountry equivalent is missing. Hope this helps, Andrwsc 19:56, 10 January 2007 (UTC)
I think country_data_* will not be called directly, so there will indeed be a flagcountry for normal use. (SEWilco 07:16, 11 January 2007 (UTC)_
I've created Template:Flagcountry2 (edit talk links history) (See also [7]) --Ligulem 10:21, 11 January 2007 (UTC)

[edit] Olympic flag usage (flagIOC etc.)

SEWilco dropped a note onto Template talk:FlagIOC that this discussion was taking place, and I'm glad he did!! I need to update you all on what I have done over the past few months. Basically, I have already decoupled {{FlagIOC}} from the {{country}} mechanism and "unrolled" the template. I still call the various country_IOC_alias_xxx and country_flag_IOC_alias_xxx templates directly, but not through another level of template transclusion. The biggest change is that flagIOC now takes an additional parameter (the specific Olympic Games year) to selectively choose the correct flag for the given Games, and to render the correct wikilink.

Some examples:

To achieve this, I changed the way each of the country_flag_IOC_alias_xxx templates work for nations that have had different historical flags. For example, {{country_flag_IOC_alias_GER}} now looks like:

{{ #switch: {{{1}}}
| 1896 Summer
| 1900 Summer
| 1904 Summer
| 1906 Summer
| 1908 Summer
| 1912 Summer = Flag of the German Empire.svg
| 1936 Winter
| 1936 Summer = Flag of Germany 1933.svg
| #default = Flag of Germany.svg
}}

Off the top of my head, I'd guess that perhaps a third of the nations for which we have IOC templates (~70-80 out of ~230) now use a conditional to select the flag.

The other thing I did was add some additional templates to help editors working on Olympic-related pages. A couple of common styles were being used on those pages, such as putting a flag icon before an athlete's name and putting a wikilink to the nation after his/her name. The templates I added are intended to greatly simplify that. Specifically:

I guess the point of my message here is that a LOT of work has gone into cleaning up the Olympic-specific flag usage, and I am happy with the current state of things. There are about ~230 flag templates and another ~230 nation alias templates that are keyed to the IOC country code, and I think it is somewhat stable now. I don't see any compelling reason to try to re-work the flagIOC mechanism any further. If it is deemed necessary to remove all the IOC_alias_xxx templates in favor of something else, it is imperative that backward compatibility be maintained for the thousands of instances in which the "new" flagIOC templates are used.

Andrwsc 06:42, 10 January 2007 (UTC)

Thanks a lot for this report. If I understand this correctly, {{country|flagIOC|..}} is no longer called from any article (If we should happen to find such a call, it can be changed to {{flagIOC|...}}). In light of this, I'll drop support for {{country2|flagIOC|..}} in User:Ligulem/work/flag templates rework. The introduction of a year parameter and a switch in a data template like this one makes it incompatible with my proposal (I was not aware of this complication). So the IOC flag templates and the data templates they use in the array(s) must stay as they are (In fact, they are no longer array elements, due to the year parameter). I just hope that the flagIOC templates don't use and won't start using non-IOC related data templates, for example, the flagIOC-templates ideally shouldn't use the Country flag alias data templates. --Ligulem 10:04, 10 January 2007 (UTC)
I just noticed that Template:Country flagIOC is orphanned. So this fits very well with what Andrwsc wrote (not that I would expect anything else :-). So, I'm going to add a bold deprecation notice on Template:Country flagIOC. --Ligulem 10:13, 10 January 2007 (UTC)
Yup, you are correct, {{country|flagIOC|..}} has not been used for a long time. If you look at that template, the wikilink to "... at the 2004 Summer Olympics" was hardcoded into it. That's what got me started down the path to the evolution of {{flagIOC}}. I wanted something scalable to all 45 past Games and future ones, and parameterizing the link seemed obvious. It was later that I figured out how the same parameter could be used to select the correct historical flag.
As far as your country data templates go, I don't see anything there that we don't already have for the Olympic templates. As SEWilco noted, the IOC country code is not always the same as the ISO code (e.g. ALG vs. DZA for Algeria). More significantly, the IOC codes include several non-country entities (for example, we use {{flagIOC|IOP|1992 Summer}} to render Independent Olympic Participants Independent Olympic Participants, and {{flagIOC|EUA|1964 Summer}} to render United Team of Germany United Team of Germany, etc.) and I don't think you want to try to force a merge of that into your country data system. I am content if the Olympic stuff remains de-coupled from that. I just don't want to see templates like {{country_flag_IOC_alias_USA}} get deleted in some future cleanup effort!! I would be happy to rename them if you want to get rid of the "country_" prefix, for example, but let me know so that we can keep all the Olympic stuff unbroken. Andrwsc 17:30, 10 January 2007 (UTC)
Nothing in use will be deleted. That would be vandalism and would quickly cost me my admin license! As you can see on this talk page, we are thinking about some improvements of the current system, like reducing the number of templates. Maintaining a large number of templates has a cost (vandalism, etc.). As I already noted, I've dropped the IOC templates from my change proposal at User:Ligulem/work/flag templates rework [8], so you are not affected by my proposal. --Ligulem 17:52, 10 January 2007 (UTC)

[edit] Handling variants, such as historical flags

Existing calls:

  • {{country|flagcountry|Brazil}} = Flag of Brazil Brazil
  • {{country|flagcountry|Brazil-1889}} = Template:Country data Brazil-1889

Using User:Ligulem/work/flag templates rework:

  • {{country2|flagcountry|Brazil}} = Flag of Brazil Brazil
  • {{country2|flagcountry|Brazil|1889}} = Flag of Brazil Brazil

See

Modifications done for this:

I admit this is getting very hairy. Thoughts? --Ligulem 13:13, 11 January 2007 (UTC)

{{country2|flagcountry|BRA|1889}} = Flag of Brazil Brazil — --Ligulem 13:34, 11 January 2007 (UTC)
Maybe this is simply not worth the potential problems with regards to increased complexity. Compare also with {{flagcountry2|Brazil-imperial}} = Template:Country data Brazil-imperial, which simply uses Template:Country data Brazil-imperial (edit talk links history). --Ligulem 14:14, 11 January 2007 (UTC)
My 2 bits - I think the right approach is to work all the historical flags into the same country data structure, but use different structures only for historical nations (e.g. don't put East Germany data into the Germany country data). This seems most logical to me, and also less likely to result in a proliferation of country data variants. Of course, that means more work up front to design a clean solution, but I have confidence in you. ;) Andrwsc 18:01, 11 January 2007 (UTC)
Ligulem did just what I thought of when I read Andrwsc's comment. Simply put more flag_alias entries in the country_data_* template. By appending variant after a hyphen, several flag_alias entries can be identified, such as flag alias-1889 pointing to a different flag image. Even better, {{Country flagcountry2}}, which displays the image, has access to all the country_data info and is able to select which flag to show (and has flexibility in changing the display format). Looks nice. (SEWilco 02:25, 12 January 2007 (UTC))
The example of "Brazil-imperial" points out that in addition to a separate flag there may be a need for a separate article and a different country label. These would only be needed in templates which show a country label (an icon alone can only be linked to the image). (SEWilco 02:32, 12 January 2007 (UTC))

[edit] Usage example: European Union

As a first example for real usage, I've copied European Union to User:Ligulem/work/European Union and converted the calls there [9] (I also created the needed data templates for that article with the help of this). Compare the list of used templates in European Union with the list in User:Ligulem/work/European Union. --Ligulem 18:34, 12 January 2007 (UTC)

[edit] Template:Country flag alias Caribbean

See Template:Country flag alias Caribbean. Is this the correct flag image? --Ligulem 22:48, 4 January 2007 (UTC)

There is an ISO "CRB" abbreviation, but what entity does it refer to and what is its flag? There are only a few linked items in Special:Whatlinkshere/Template:Country_flag_alias_Caribbean (SEWilco 04:58, 5 January 2007 (UTC))

[edit] Discussion at MoS on flag icons

Please contribute to the discussion on flag icons at Wikipedia talk:Manual of Style#Flag icons - manual of style entry?. (SEWilco 14:43, 15 January 2007 (UTC))

[edit] Help! Nazi Germany

I'm working on the Fieseler Fi 156 page, and need something along the lines of Template:GER except with the German WW2 (Nazi) flag to be historically accurate. Is there a template for that? Also, is there a place where I can find a list of all of the flag icons that can be called using the [[Template:(countrycode)]] format? This list helped loads but only shows current nations, and the category for flag templates is woefully incomplete (Template:PNG was not included, for instance). Thanks! - Aerobird Target locked - Fox One! 16:57, 16 January 2007 (UTC)

Try {{flag|Nazi Germany}} (SEWilco 03:10, 17 January 2007 (UTC))
Yes! Thank you! :-) - Aerobird Target locked - Fox One! 03:41, 17 January 2007 (UTC)

[edit] Oh noez - substed flag alias templates

I looked at the what links here of Template:Country flag alias United States (to see where that is still used now) and opened Biathlon. Then I found that Country flag alias XXX are used directly there: Introduction of the flags, substing (!). Is/was this general accepted practice? Would we have to face some opposition if we would try to mass-"unsubst" such things with {{flagicon}} et al? Puzzled, --Ligulem 00:18, 27 January 2007 (UTC)

I don't believe it is a widespread practice, but it does happen, as you've seen. I think I replaced this once or twice on some other pages a couple of months ago without complaint. (In that case, it was inappropriate use of the country_flag_IOC_alias variants which I replaced with flagicon, on a page about world war II films, if I remember...) These should be easy to spot after you've upgraded the main templates, as they would be the few remaining direct links to the old country_flag_alias_xxx templates. Andrwsc 00:32, 27 January 2007 (UTC)
I just noticed that many of those remaining links to are due to {{flagof}}, which ought to be replaced. I will do something in the meantime. Andrwsc 00:39, 27 January 2007 (UTC)
Additionally, there are several places where Template:Country_flagicon is called directly. That should be updated as well. Andrwsc 00:53, 27 January 2007 (UTC)
Oh yes. Subst "zombies" (I mean the result of the subst, not the Wikipedian – just to be clear ;-) like this one. I already did some mass removals of flags in signatures (duh! [10]). I'm going to zap these as well per WP:SIG. --Ligulem 09:11, 27 January 2007 (UTC)
I had dropped a note on that user's talk page yesterday about the strange sig (uses a conditional that always tests true?) and he has replied that he no longer uses that flag, but in the meantime, there are dozens of talk pages that use the old sig...
I also found some other templates yesterday that used to call country_alias_xxx templates directly. I have fixed Template:flagof and Template:Bilateral to use the standard calls, so that should cut down a large number of "zombies" too. Andrwsc 16:50, 27 January 2007 (UTC)
Just for the records: There are now zero pages in main namespace transcluding Template:Country flag alias United States [11]. --Ligulem 19:10, 27 January 2007 (UTC)

[edit] Categorisation error

Thought y'all might want to know that a whole load of extranious pages have been categorised under Category:Flag templates. True, there were a number of country templates that needed to be added, but somebody went overboard... - Aerobird Target locked - Fox One! 14:42, 29 January 2007 (UTC)

Thanks for reporting. I did a Special:Recentchangeslinked/Category:Flag_templates and looked for changed templates. Quickly spotted template:SYR: [12]. User:Akradecki simply forgot to wrap the cat into noincludes :-) (this sort of error happens easily, I have done this error myself too occasionally :-). So, just an error, not vandalism (I toned down the section title from "Categorisation vandalism" to "Categorisation error"). And fixed it. --Ligulem 15:34, 29 January 2007 (UTC)
Thanks for the fix. :-) - Aerobird Target locked - Fox One! 15:55, 29 January 2007 (UTC)
The job queue is currently floating around 20'000 entries, so it will take some time until the articles are updated. So don't be surprised if the cat is still overpopulated at the moment :-). On Mondays it might take half an hour or so until the servers have caught up... --Ligulem 15:58, 29 January 2007 (UTC)

[edit] Some thoughts...

I have been helping out the transition effort to the new "country data" based template calls, and have some observations based on what I have seen.

First, both the original implementation and the new one were based on a single template ({{country}}) that had a variety of "action" or "formatter" arguments, which in turn caused the invocation of a "second layer" of template calls. My observation is that virtually nobody uses the {{country|action|...}} style of template calls. If they are still needed for internal operation, that's fine, but we should document it as internal use only. We should not promote the use of {{country}} as something editors should use in wiki markup in normal usage.

Furthermore, some of these "actions" are also virtually unused, namely flagISO and name. I see one usage of {{country|name|...}} in Template:Bilateral, but that's about it.

Next, I see that the vast majority of articles require one of two things:

  • a flag icon, followed by a country name or code that is wikilinked to the article for that country
  • just the flag icon by itself

Obviously, {{flagicon}} is the preferred way to render the latter. Right now, there is a wide variety of names used as the country parameter to that template (e.g. sometimes the name of the nation is used, and sometimes a country code is used), but the end result is the same. Therefore, {{flagicon|USA}} and {{flagicon|United States}} render exactly the same thing, and I think that is a good thing.

For the former, I see three techniques used:

  1. {{flagcountry}}
  2. {{flag}}
  3. shortcut template names (such as {{USA}}) that typically render the same thing as a call to {{flagcountry}} (see full? list at Wikipedia:Inline templates linking countries)

The problem I see is that {{flagcountry}} and {{flag}} do more or less the same thing, but with a different name for the wikilinked country string. One thing they do is "translate" the country argument so that you get a full name out of {{flagcountry}} and a ISO code out of {{flag}}. For example:

In my mind, this is not intuitive. I think it is a good thing that the input argument to these templates can be either a name or a code, but I don't think it is useful for the output string to be modified.

What is especially vexing is that we accept non-ISO country codes as input arguments, but always use the ISO code for the output of {{flag}}. This results in some strange wikicode. If I want to render Flag of Germany GER (e.g. for sports articles where "GER" is the country code for Germany), there is no easy way to do it. {{flag|GER}} gives me Flag of Germany GER. One solution is to write {{flag|GER|name=GER}}, but that is obtuse to say the least!

It seems to me that we don't really need both {{flagcountry}} and {{flag}}. We need to make it easy for editors to put a flag in front of their desired string. What seems most intuitive to me would be for this behaviour:

  • {{flag|Germany}} renders Flag of Germany Germany
  • {{flag|DEU}} renders Flag of Germany DEU
  • {{flag|GER}} renders Flag of Germany GER

I think this is technically easy to do. The modified flag template would set the name= argument to the first parameter, or something like that. I haven't mocked it up yet.

What would be more time consuming is going through the instances where flag or flagcountry is used and see if they are depending upon the "translation" capability or not.

One thing I would not touch is the set of "shortcut templates" (like {{USA}}), as editors clearly know what to expect from that.

Comments? Andrwsc 00:22, 1 February 2007 (UTC)

Not yet a complete response, but I was also puzzled why people would use {{country|flagcountry|...}} instead of the simpler {{flagcountry}} (did some of these: [13]). In fact, template:country makes tracking the different sorts of calls more difficult, as it is easy to do a "what links here" of {{flagcountry}} whereas {{country|flagcountry|...}} cannot be enumerated without visiting every call (or scanning a database dump). Note that template:flagcountry no longer calls template:country ([14]). As a side note, I would like to point out that the change I did with the data templates is just an internal refactoring, so the "new" system provides the same functionality as SEWilco's original implementation. Just with less templates. I have now unprotected all of the original array templates, which are nearly completely orphanned. (Going to bed now). --Ligulem 00:55, 1 February 2007 (UTC)
I guess a quick summary of my comments is that I realize that your work mostly provides a more efficient implementation of SEWilco's original work (using wiki features not available to him at the time), but perhaps we should re-examine the full scope of that implementation, now that we have a year or two of usage to look at. Exactly what problems do we need solutions for? Can we remove unused features and fix ones that are "broken" in the eyes of some editors?
Have a good sleep. ;) Andrwsc 01:00, 1 February 2007 (UTC)
FYI, I researched current use counts (Warning: table below is transcluded from Wikipedia:WikiProject Flag Template/Table 2007-02-01):
Template # pages
calling
Used when calling..
Template:flagicon 41,659 Updated 13:13, 2 February 2007 (UTC)
Template:flagcountry 13,523 Updated 13:13, 2 February 2007 (UTC)
Template:Country 106 Updated 14:05, 2 February 2007 (UTC)
Template:flag 1,037 Updated 13:13, 2 February 2007 (UTC)
Template:ISO 7 Updated 13:13, 2 February 2007 (UTC)
Template:Country flagicon2 41,635 {{country|flagicon|..}}, {{flagicon|..}} Updated 13:13, 2 February 2007 (UTC)
Template:Country flagcountry2 13,561 {{country|flagcountry|..}}, {{flagcountry|..}} Updated 13:13, 2 February 2007 (UTC)
Template:Country flag2 1,046 {{country|flag|..}}, {{flag|..}} Updated 13:13, 2 February 2007 (UTC)
Template:Country name2 66 {{country|name|..}} Updated 13:13, 2 February 2007 (UTC)
Template:Country flagISO2 7 {{country|flagISO|..}} Updated 13:13, 2 February 2007 (UTC)
Template:Country get alias2 6 {{country|get alias|..}} Updated 13:13, 2 February 2007 (UTC)
Template:Country get flag alias2 6 {{country|get flag alias|..}} Updated 13:13, 2 February 2007 (UTC)
Note that {{Country flagISO2}} is almost only called on the template:Country data XXX pages (ditto for {{Country name2}}). Category:Country data templates has 777 entries. --Ligulem 14:33, 1 February 2007 (UTC)
This is interesting, and encouraging! I think that "flag" is far too valuable a template name to be used for just it's current purpose (flagicon + wikilinked ISO code), but since it is used in only 1000-2000 pages, it might be possible to redefine it in a backward compatible way as I've described above. For example, all instances of {{flag|Country Name}} would be replaced by {{flag|ISO}} first. This would have no effect on the rendered pages. Then we can extend the functionality of {{flag|...}} without causing any changes to those 1000-2000 pages. Finally, the new functionality can be published and used (instead of flagcountry, for example) as editors see fit. Andrwsc 20:15, 1 February 2007 (UTC)
Another note - my proposed functionality is absolutely trivial to implement. Take a look at User:Andrwsc/Flagtest (and test calls on the talk page), which is basically a direct copy of {{flagcountry}} but with one very small difference - the name parameter defaults to the first template argument instead of blank. Andrwsc 22:17, 1 February 2007 (UTC)
Neutral observation: If we would replace the code of {{flag}} with [15], this would mean that the "label alias" values of the country data templates would no longer be used for {{flag}} calls (see [16]), because {{{name}}} is then either set by the caller or defaulted to what is provided as parameter 1 of {{flag}}. --Ligulem 23:56, 1 February 2007 (UTC)

[edit] ISO alias, flag ISO alias

Because it's untranscluded in articles I've redirected Template:Country flagISO2 (has a total of 5 transclusions) to Template:Country flagcountry2 and removed the ISO options from Template:Country/doc ([17]). Would anybody yell at me if I would mass remove the now unused "ISO alias" and "flag ISO alias" parameters from the country data templates? --Ligulem 14:26, 2 February 2007 (UTC)
I wouldn't yell! I just don't think we need a template that translates a long name to a country code. I think we only need for the flagxxx templates to accept country codes as input arguments, and that is accomplished by creating redirects such as from {{Country_data_DEU}} to {{Country_data_Germany}}, to name one example. Obviously, the flagISO methods originally conceived have not been used by editors since then, so I think it is safe to remove them during this re-implementation effort. Andrwsc 17:41, 2 February 2007 (UTC)

[edit] countryname instead of label alias

How about just doing this to {{Country flag2}}? {{{countryname}}} is parameter {{{1}}} feeded through from {{flag}}. All country data templates feed {{{countryname}}} into {{Country flag2}} when called from {{flag}} (this is true for all entry points). --Ligulem 20:04, 2 February 2007 (UTC)

I'm not sure that would work the same way. If we are using redirects for the country code inputs (e.g. {{Country data GER}} → {{Country data Germany}}), then this parameter would be "Germany" in all cases instead of "GER" or "DEU" if desired. Andrwsc 21:57, 2 February 2007 (UTC)
I think you are wrong. In the call {{flag|Germany}}, {{{countryname}}} has value "Germany". In the call {{flag|GER}}, {{{countryname}}} has value "GER". I will elaborate that below in a moment. --Ligulem 23:07, 2 February 2007 (UTC)

(1) {{flag|GER}}
(2) expands to: {{country data GER | country flag2 | countryname = GER }}
(3) expands to (redirect): {{country data Germany | country flag2 | countryname = GER }}
(4) expands to: {{country flag2 | alias = Germany | shortname alias = Germany | label alias = DEU | flag alias = Flag of Germany.svg | countryname = GER}} (I already left away the ISO params here)
(5) would expand to: [[Image: Flag of Germany.svg|22x20px|Flag of Germany]] [[Germany|GER]] (if we presume we set {{Country flag2}} to use this template code)
--Ligulem 23:26, 2 February 2007 (UTC)

Ah, I see now, thanks! The trick is that "countryname" is set before the redirect, not after (as I had thought). Andrwsc 00:11, 3 February 2007 (UTC)
And as for the proposed change, I think we need two things: 1) more discussion, especially SEWilco's input, since this is a fairly major redefinition of a high-use template, and 2) replacement of all existing calls to {{flag}} to change the input argument to the code string if it already isn't, thus ensuring backward compatibility. For that, I'll need your help to edit the protected template. The "temporary category" trick is what I have in mind to get a list of articles use flag with a full-name argument:
{{ #ifeq: {{{label alias}}} | {{{countryname}}} | <!-- ok --> | [[Category:Articles that use Flag without country codes]] }}
Andrwsc 00:22, 3 February 2007 (UTC)
I'm a bit puzzled. Wouldn't that have been needed with your proposal (User:Andrwsc/Flagtest) as well, or is there some additional complexity with my counter-proposal? Puzzled. On another note, I've seen enough flag templates for today (We must be really mad doing all this ;-). See ya. --Ligulem 00:48, 3 February 2007 (UTC)
...and I don't know where to put your template code snippet. (Now I'm really gone for today). --Ligulem 00:51, 3 February 2007 (UTC)
Ok. Got it [18]. And created Category:Articles that use Flag without country codes. --Ligulem 08:50, 3 February 2007 (UTC)
I saved the content of the cat at User:Ligulem/work/Articles that use Flag without country codes. --Ligulem 09:11, 3 February 2007 (UTC)
...and reverted the temporary change on the template [19]. --Ligulem 09:13, 3 February 2007 (UTC)
...and deleted the cat after it was orphanned. --Ligulem 09:44, 3 February 2007 (UTC)
I removed all country data templates from the list [20]. --Ligulem 09:53, 3 February 2007 (UTC)
Sorry, I was away for a few hours, but it looks like you figured out what I was trying to say! I had noticed that of the ~1100 pages on the "What links here" list of {{flag}}, a large number were because of the link from country_showdata, but also that a large number were pages that had a small handful of {{flag|USA}}, {{flag|EU}}, etc. For example, pages on books or video games use these templates for release dates, etc. What I really wanted to know was how many pages actually relied upon the "translation" ability of that template, and had a large number of {{flag|Germany}}, {{flag|France}}, etc. instead of being written with the country codes as input arguments. I am somewhat astonished — in a good way! — that there are only 94 pages on your list, and a small subset of that in the main article space!! I think that reinforces my proposal, that this change would not negatively impact very many articles at all. Thanks for your help - I think I'll work on the articles on that list to potentially prepare for the transition. Andrwsc 19:51, 3 February 2007 (UTC)
I made Template:FlagA (edit talk links history) (for "flag Andrwsc" :-):
  • {{flagA|Germany}} = Flag of Germany GermanyFor testing only!!!
  • {{flagA|DEU}} = Flag of Germany DEUFor testing only!!!
  • {{flagA|GER}} = Flag of Germany GERFor testing only!!!
  • {{flagA|GER|name=voodoo}} = Flag of Germany voodooFor testing only!!!
  • {{flagA|GER|size=30px}} = Flag of Germany GERFor testing only!!!
as a mock-up. It uses Template:Country flagA2 (edit talk links history). --Ligulem 23:54, 3 February 2007 (UTC)
What's the status quo with this? --Ligulem 09:41, 21 February 2007 (UTC)

[edit] Template:flag and the link to the Wikipedia article

Andrwsc wrote: What seems most intuitive to me would be for this behaviour:

  • {{flag|Germany}} renders Flag of Germany Germany
  • {{flag|DEU}} renders Flag of Germany DEU
  • {{flag|GER}} renders Flag of Germany GER
What should be done with current calls
? --Ligulem 23:14, 3 February 2007 (UTC)
?? --Ligulem 23:58, 3 February 2007 (UTC)
Heh, I like the subsection heading. ;) Here's my opinion on each of those first six examples:
  • {{Country data Bulgaria 1946}} should be deleted and the flag put as a "1946" variant inside the main {{Country data Bulgaria}} template. Then, to render that variant, you would call {{flagcountry|Bulgaria|1946}}
  • works fine as is
  • I would make the main data structure for each of the 50 states aligned with the main article name, so it would be {{Country data Florida}} in this case. There would be at least two redirects, one from {{Country data FL}} and another from the existing {{Country data USA-FL}} for backward compatibility. Then, you could just use {{flag|FL}} to get the state code or {{flag|Florida}} to get the full name. flagcountry with any of those three parameters would render "Florida".
  • works fine as is
  • I would do two things. Since Weimar Republic is a main article, we ought to use {{Country data Weimar Republic}}. There should be a variant in the {{Country data Germany}} template if the editor wants to make the wikilink to Germany. (In fact, I did that yesterday in my first attempts with the variant code.) That gives the editor a few options: {{flag|Weimar Republic}}, {{flag|Weimar Republic|name=Germany}}, {{flag|Germany|Weimar}}, etc. It all depends on what you want the wikilink to point to and what you want the name to say.
  • works fine as is
I'm not exactly sure what answers you were unsure of, but hopefully my opinions here are logical. I think you can see what I am driving at. Andrwsc 07:33, 4 February 2007 (UTC)
What should be done with:
Isn't that a name clash on {{country data Georgia}} with your new system? Please state the calls you would like to use for these two in your new system. --Ligulem 10:01, 4 February 2007 (UTC)
Hmmm. Andrwsc wrote: "There should be a variant in the {{Country data Germany}} template if the editor wants to make the wikilink to Germany". I do not understand that completely. We currently have {{{variant}}} used for the "flag alias" parameter of the data templates but not for "alias" ([21], [22]). Do you mean that the variant system should be extended onto the "alias" parameter? This sounds like getting very nasty. If we need variants for every field in the data templates, we start mimicking data template forks inside data templates. Plus I fear your "most intuitive" system produces name clashes on the data templates. It looks neat on the "GER", "DEU", "Germany" example, but I fear it causes problems when we try to implement that completely. Names of the data templates (or redirects to them) are then predetermined by what the link text should read. This smells a bit like a non-orthogonality to me. --Ligulem 10:29, 4 February 2007 (UTC)
No, not at all!! Let me try to explain my ideas again.
Within the country_data templates, alias is fixed to a single value, the name of the main Wikipedia article. It cannot be changed. If you want a new link, you need a new country_data structure. Conversely, that also means that we shouldn't have country_data structures for non-existant articles. They should be redirects to the "real" one. Using Florida as an example of this concept, Country_data_Florida is correct as is. County_data_FL and Country_data_USA-FL only exist so that "FL" and "USA-FL" can be used as alternatives to "Florida" in the calls to the flag, flagcountry, and flagicon templates.
Next, 'shortname alias' is also fixed to a single value within the template, but can be overridden in one of two ways. For flagcountry, the name= argument would be used. For the proposed flag (flagA now ;), the first argument used with the template call would be used.
Next, the 'flag alias' is the one parameter within Country_data structures that will have multiple variants. I think this is WAY more logical to handle situations like the 1946-1967 flag of Bulgaria. There is no reason to create a new Country_data structure, espectially since the alias and shortname_alias fields would be the same. For editors wanting to use that flag, it is an extremely minor change from a space to a pipe character! (e.g {{flagcountry|Bulgaria|1946}} instead of {{flagcountry|Bulgaria 1946}}
As for any confusion I created with my response on Weimar Republic, let me elaborate. Since there are articles for both Germany and Weimar Republic, I think that means we ought to have Country_data templates for both. In different instances, editors may want to link to either one. {{flagcountry|Germany|Weimar}} renders Flag of Germany Germany and {{flagcountry|Weimar Republic}} renders Flag of Weimar Republic Weimar Republic Of course, you could also use {{flagcountry|Weimar Republic|name=Germany}} to render Flag of Weimar Republic Germany
Finally, with respect to the name conflict on Georgia, we maintain the existing status quo. I think Template:Country data Georgia already does the right thing. The main template for the US state would need to be Template:Country data Georgia (U.S. state), with redirects from the two shorthand labels, Country_data_GA and Country_data_USA-GA. This means that you can do these:
To be honest, I don't think I've seen any instance of flagcountry with any of the US states - they tend to use the current flag to get the two letter code instead - so I think these ideas don't impact any current pages.
I hope this makes sense! I don't think I'm proposing anything radical here, just a cleanup and merge from many of the redudant Country_data structures into the main ones for each country, using flag variants and redirects as appropriate. Andrwsc 17:14, 4 February 2007 (UTC)
I feel quite confident that you know what needs to be done :-). I probably just do have some problems following you. I agree with doing "flag alias XXX" for cases like the 1946-1967 flag of Bulgaria and I agree that it makes sense to name the Country data templates after the main article (So having template:Country data Florida, template:Country data Georgia (U.S. state) and template:Country data Weimar Republic). What still confuses me is your sentence "There should be a variant in the {{Country data Germany}} template if the editor wants to make the wikilink to Germany". I interpret this as doing a country data template like this:
...
flag alias = wee bee.svg
flag alias-variant1 = blurp blomp.svg
flag alias-variant2 = foo bar.svg
label alias = bla
label alias-variant1 = bla bla
label alias-variant2 = ping pong
...
which I think would be A Bad Thing™ (but I now have some doubts you really meant that). --Ligulem 19:08, 4 February 2007 (UTC)
No, I definitely don't mean that! I guess that sentence was a bit unclear. What I meant was that I think there are instances where editors will want to use the Weimar Republic flag, but still use Germany as the wikilinked country. That means we need a variant inside the Country_data_Germany structure to show that flag, but retain "Germany" as the alias and shortname alias. We're giving editors more options, in a logical, scalable way, by providing both {{flagcountry|Germany|Weimar}} and {{flagcountry|Weimar Republic}}. Andrwsc 00:02, 5 February 2007 (UTC)
Ok. I think I got it now. Everything in harmony then ;-). --Ligulem 00:10, 5 February 2007 (UTC)
All calls {{flagcountry|USA-FL}} = Flag of Florida Florida in articles would need to be changed to {{flag|Florida}} = Flag of Florida FloridaFor testing only!!! prior to exchanging the code of template:flagcountry with template:flagA (or User:Andrwsc/Flagtest), because {{flagA|USA-FL}} = Flag of Florida USA-FLFor testing only!!! would break current expectations, right? (I believe there is no article using template:country data USA-FL on User:Ligulem/work/Articles that use Flag without country codes) --Ligulem 11:05, 4 February 2007 (UTC)
Yes, definitely. The templates for the 50 US states, and 10 Canadian provinces (e.g. CAN-BC) are the only ones that don't have existing Country_data templates under the "right" name, I think. Fortunately, there are less than 10 pages that use them with the flag template, I think. Most of the time, flagicon is used, so the label doesn't matter. Andrwsc 17:14, 4 February 2007 (UTC)
Have a look at my log ;-) --Ligulem 00:10, 5 February 2007 (UTC)
I changed the section title from "Andrwsc's most intuitive behaviour" to "Template:flag and the link to the Wikipedia article" --Ligulem 09:35, 21 February 2007 (UTC)
What's the status quo with this? --Ligulem 09:35, 21 February 2007 (UTC)
I would say that we are almost finished with getting all the redirects sorted out and getting all the flag variants merged. I will look at the remaining pages that rely on the "translation ability" of the existing {{flag}} before we make the next step. Andrwsc 17:31, 21 February 2007 (UTC)

Done:

  • {{flag|Germany}} = Flag of Germany Germany
  • {{flag|DEU}} = Flag of Germany DEU
  • {{flag|GER}} = Flag of Germany GER

--Ligulem 18:57, 23 February 2007 (UTC)

[edit] Major rewrite of the project page

I've done a major rewrite of the project page to adapt for the new template system used (the country data templates). --Ligulem 16:29, 9 February 2007 (UTC)

[edit] Bordered icons

A few months ago, people starting using alternate flag images for flag icons, specifically, modifications to the "main" flag image to put a black border around it. The improvement is noticable at 22x20px (e.g. compare Japan at vs. ). This method seems to have caught on instead of using the {{border}} template for a couple of reasons (my speculation): it is simpler to add the bordered version to the flag template, thereby instantly updating all occurances, and it results in less complexity in the eventual page rendering.

One problem is that the bordered versions do not look very good when shown at a larger size. The {{border}} template produces much better results. This means that editors are forced to use the image directly instead of using any of the flag templates (e.g. compare {{flagicon|Japan|size=150px}} vs. {{border|[[Image:Flag of Japan.svg|150px]]}})
Flag of Japan vs.

What I would like to propose is that we add "icon alias" entries to the country_data templates for nations that need a "(bordered)" version for icon usage. The flag templates would select either "flag alias" or "icon alias" based on the presence of the "size" parameter or not. For example, the code for {{country flagicon2}} would now look like:

[[Image:{{
  #if: {{{variant|}}} | {{{flag alias-{{{variant}}}}}} | {{#if: {{{size|}}} | {{{flag alias}}} | {{{icon alias|{{{flag alias}}}}}} }}
}}|{{
  #if: {{{size|}}} | {{{size}}} | 22x20px
}}|Flag of {{{alias}}}]]

(This is off the top of my head and not sandboxed, but you get the idea.)

One other benefit I can see by having both bordered and non-bordered versions of the flag within the country_data structures is that it might stop or reduce edit/revert cycles over which one is "best". Editors have two methods by which to get the flag they want. Normal usage of flagicon or flagcountry would give the icon version (if available); editors can override and get the non-bordered version by specifying any size (even 22x20px).

I think using the size parameter as the "key" for selection makes most sense because it is the size of the flag that determines whether or not the "(bordered)" versions look good or not. Andrwsc 20:09, 20 February 2007 (UTC)

I would like to know how to proceed with #countryname instead of label alias and #Template:flag and the link to the Wikipedia article before adding additional parameters to the country data templates. --Ligulem 09:50, 21 February 2007 (UTC)
Fair enough. My wife also tells me to finish some projects before starting new ones... ;) Andrwsc 17:26, 21 February 2007 (UTC)
FWIW, I say use {{border}} and simply do this on a flag-by-flag basis consistently (starting with {{Flag|JPN}} and its variants!), for flags with white that will hit the edge of the picture. I.e., fix all the templates, rather that resort to using alt. images that look terrible at full size. — SMcCandlish [talk] [contrib] 11:24, 26 February 2007 (UTC)

[edit] Alt text "Flag of Country"

The default hover box over flag icons is to use "Flag of {{{alias}}}", which is a great idea. One minor problem is that it produces incorrect grammar for some nation names. For example, it should really read "Flag of the United States" instead of "Flag of United States". The Netherlands, United Kingdom, Bahamas, and a few other countries also share this issue.

One extremely simple and effective fix would be to add something like "alias prefix = the" to the country_data structure for those handful of nations, and then change code to render the caption to:

|Flag of {{alias prefix|}}} {{{alias}}}]]

On a related note, I'd like to add a "See also" notice to {{country showdata}} to link to the appropriate "[[Flag of {{alias prefix|}}} {{{alias}}}]]" article, as I think it would be a very useful reference for historic flag maintenance, and this would also be a good way to find all the nations that need the "the" prefix. Andrwsc 20:09, 20 February 2007 (UTC)

Just a quick note: this is not only a "hover label" or "..box". It is also called alt text. Important for blind readers or users who have turned off pictures in their browser. (Quote from alt attribute: "It is not intended to provide "pop up" text or tooltips when a user's mouse hovers over the image, though alt text has historically been presented in this way in some web browsers."). I changed the section title accordingly (was: "Hover label: "Flag of Country""). --Ligulem 09:22, 21 February 2007 (UTC)
I would like to know how to proceed with #countryname instead of label alias and #Template:flag and the link to the Wikipedia article before adding additional parameters to the country data templates. --Ligulem 09:52, 21 February 2007 (UTC)
After having thought a bit about this proposal, I agree doing this, but how about specifying the alt text completely? So, I'm thinking about changing for example Template:Country flagicon2 from:
[[Image:{{
  #if: {{{variant|}}} | {{{flag alias-{{{variant}}}}}} | {{{flag alias}}}
}}|{{
  #if: {{{size|}}} | {{{size}}} | 22x20px
}}|Flag of {{{alias}}}]]
to
[[Image:{{
  #if: {{{variant|}}} | {{{flag alias-{{{variant}}}}}} | {{{flag alias}}}
}}|{{
  #if: {{{size|}}} | {{{size}}} | 22x20px
}}|{{
  #if: {{{alt alias|}}} | {{{alt alias}}} | Flag of {{{alias}}}
}}]]
and adding "alt alias = Flag of the United States" to template:country data United States --Ligulem 19:26, 26 February 2007 (UTC)
That would work, but might be more than necessary. I think that all instances of "alt alias" would merely have the addition of the word "the" in the name. I think there are no other textual variations. If that's indeed the case, I think we could avoid that extra conditional and use the "alias prefix = the" suggestion I had above. We would not have to put "alias prefix" into any template except the handful that need it.
In order to try this out, I think the first step might be to put this into Template:country showdata:
{{See also|Flag of {{{alias}}}}}
(not tested, but you get the idea). I'd like to see something like this in country_showdata permanently, since I found that I was often looking at those series of articles when I was adding flag variants to the country_data templates. It would be a useful addition to the user documentation to provide some descriptive context about when to use flag variants. In addition to the permanent benefit, this would also help us now identify which templates need "alt alias" or "alias prefix" since the "Flag of alias" article would either be redlinked or point to a redirect (as almost all of the ones missing "the" already do). Andrwsc 19:46, 26 February 2007 (UTC)
"That would work, but might be more than necessary": My programmer stomach tells me that your proposal is needlessly rigid and non-orthogonal. You give up a flexibility for no good reason. Who knows what text we will need in the future? I don't think that the length of the value that has to be entered for an additional parameter matters in any way. The question is do we have to enter that param or not? And it has to be entered only where the default is incorrect. As for the known cases of the United States or the Bahamas. Just a wild remote idea for such an alt text would be "Seal of xxx". Currently not remotely in sight, but who knows... --Ligulem 20:21, 26 February 2007 (UTC)
Ok, fair enough. My programmer stomach tells me to look for simplicity and elegance. ;) Maybe that's because I used to do a lot of embedded systems work, so I place a premium on compactness. Anyway, I'm not hung up about it, and your reasons are probably more future-proof than mine, so if you want to run with that, I support it. My only requests are that we keep it an optional parameter for country_data templates so that it doesn't appear where it needs to, and we use it to add the "Flag of ..." link to the showdata template to help documentation. Thanks, Andrwsc 20:39, 26 February 2007 (UTC)
Uh. Now you tell me my solution is not elegant and not simple. Damn :-). Two bored template fiddlers, I'd say. Seriously: I don't mind either. As I'm not really a user of the flag templates, I would say do it as you see fit. Chances are good you can edit the relevant templates yourself in a few days :-). --Ligulem 22:59, 26 February 2007 (UTC)
Heh! Thanks. I'll add the link to showdata first, and I want to take a final(?) pass through the country_data list before mucking with the implementation, I think. Andrwsc 23:35, 26 February 2007 (UTC)

[edit] National team templates

I think by far the most common usage of flag icons is for sports result pages. It seemed as though they were mostly what I have been editing recently to update flag template calls. One observation is that several team sports each have their own very large set of flag templates that effectively reproduce what we have implemented here. For example, check out Category:National football team templates, which has approximately 850 templates alone! Other sports, such as ice hockey, rugby union and cricket all have similar template sets, but they are not as well-documented as the football ones.

Some problems with this system are that the calling convention for historic flags is different between sports, and different from the variant labels we have started to use. Furthermore, they are not always accurate or complete. For example, not all of the US flag variants exist, so some editors had to resort to using the image directly. Another example - Canada is shown as only having one historic flag (see {{CANfold}}) when there were actually three different red ensigns.

What I'd like to propose, and this will have to be done with approval of each sport's WikiProject, is to consolidate upon the country_data templates and replace the sport-specific templates. It was trivially easy to create a single template that I would estimate can be used for 90% of those football specific ones. I created {{national sports team}} as the main template to render the flag and link, and then {{fb}} for a football specific one.

For example:

Old New
{{ITAf}} Italy {{fb|ITA}} Flag of Italy Italy
{{ITAfold}} Italy {{fb|ITA|old}} Flag of Italy Italy

This is an extremely scalable system. We only need per-sport templates (like {{fb}}) for football, but for ice hockey, basketball, rugby union, etc. as per Category:National sports teams to replace over a thousand specific instances. There are a few special cases where the team flag is different or the team name is different (e.g. instead of New Zealand national rugby union team, the preferred name is at All Blacks), but the beauty of the country_data system is that special cases can be handled there (for example, use an override parameter like "rugby union national team = All Blacks" inside country_data_New_Zealand). Some tweaking to {{national sports team}} is needed to pick up those names, as is handling of nations that have both men's and women's team articles, but neither is a big deal.

In any case, I'd like to get some discussion and consensus here before bringing this to the respective sports wikiprojects. Andrwsc 20:09, 20 February 2007 (UTC)

I'm somewhat frightened by the idea of adding "rugby union national team = All Blacks" inside country_data_New_Zealand. But I could be wrong. --Ligulem 09:58, 21 February 2007 (UTC)
Yeah, that was one thought I had too. It makes the country_data system less elegant in some ways, but perhaps more powerful in other ways. I just hate to see hundreds to thousands of redundant templates... Andrwsc 17:27, 21 February 2007 (UTC)

[edit] Use simplified flag icons

vs. Image:Icons-flag-us.png
The squashed images of complex flags when shrunk can obscure the entire design. I recommend we use the simplified small flag designs at Commons:Category:Flag icons instead.--Pharos 09:20, 26 February 2007 (UTC)

I vastly prefer the first to the second; and the sizes of the latter can't be normalized; the ones you're suggesting are all laterally squished, with incorrect proportions. — SMcCandlish [talk] [contrib] 11:16, 26 February 2007 (UTC)
PS: The beauty of using the real thing is that if one wants to see the little details (cf. Flag of Portugal POR for example) just click on the flag! — SMcCandlish [talk] [contrib] 11:21, 26 February 2007 (UTC)
The whole point is that the designs are simplified so that you can actually recognize the flags at small scale. It would be possible to code it to click on the flag icons and go to the main flag images, if one wanted to. Also, if you have problems with this particular set of simplifications, it is always possible to modify them.--Pharos 16:45, 26 February 2007 (UTC)
I don't find the US icon any more recognizable than the 22px version of the "real thing" - in fact, less so because the proportions and colors are wrong. Also, using a fixed small size image totally obsoletes the "size=" parameter, so you could not use the standard templates to render flags at any size, but only the default size. Andrwsc 17:46, 26 February 2007 (UTC)
I recognized the point, Pharos, I just think that the "simplified" icons look bad. They look cartoonish and amateur, like something from the Web ca. 1995. And as noted, they simply don't work. If you click on them to get a good look at the flag, you don't get a good look at the flag. While there is a hack that lets images act as anchors to something else around here, there's been talk of TfDing that template, just in the last week. — SMcCandlish [talk] [contrib] 20:07, 26 February 2007 (UTC)

[edit] year variables?

I spoke with Andrwsc (talk contribs) on my talk page about the following, and he suggested I bring it up here. Rather than paraphrase, I'm going to C&P the conversation here and then elabourate if anybody has any questions. — pd_THOR | =/\= | 16:40, 12 March 2007 (UTC)

[edit] Help with Template:Country data Canada

Hi, I just now noticed your message on Template talk:Country data Canada. These templates are used internally by the {{flag}}, {{flagicon}}, and {{flagcountry}} templates. If you still need help, please let me know! Andrwsc 18:41, 7 March 2007 (UTC)

Hello! I understand how these function at a very limited level, I think it has something to do with meta data and invisible fields? Anyway, I have a question. I know that Template:Country data Canada has variables for specifying flags for specific years (i.e. 1868, 1921, 1957), but these are very specific--that is, they don't parse for the years in between. If I type in {{flagicon|Canada|1900}}, I get errors when what I wanted it to show was the same thing I would have gotten had I typed in {{flagicon|Canada|1868}}. Many countries don't even offer the same limited functionality as Canada's, I know Template:country data Saint Lucia (or El Salvador, Chile, Peru, Armenia, etc.) doesn't offer different dates for the varying flags over the years. I know it's possible to add this parsing function because {{USN flag}} does it: I can type in {{USN flag|1809}} and get the appropriate United States naval jack which was flown in 1809. Can this same functionality be added to the {{flagicon}} template? — pd_THOR | =/\= | 23:41, 7 March 2007 (UTC)
Right now, the mechanism used to select historical flag variants with the flag and flagicon templates is to use a string to identify it. Most of the time, that string is a year (as is the case with the three variants for Canada), but named labels are used for other countries (e.g. look at Template:Country data Germany to see the set of variants available there. In Canada's case, it seemed clearest to make the label names the same as the year of introduction instead of "red ensign #1", "red ensign #2", etc.
If there are some specific Country_data templates that are missing historical flags (you mention a few), then they can be easily added. Perhaps post a message at Wikipedia talk:WikiProject Flag Template if you are uncomfortable with making the changes yourself. The Country_data mechanism is relatively new, and we only used the set of historical flags that existed in the previous set of templates, but we can certainly add more.
As for selecting the flag based on the year, I'm not sure that we can easily do that in a backward compatible way, but again, I'd post a message to that project and we'll discuss it there. Andrwsc 00:07, 8 March 2007 (UTC)

[edit] How can people add non-national flag icons?

I'm running into trouble trying to add an appropriate flag icon for Battle of Peregonovka (1919). Thanks. Jacob Haller 17:44, 12 March 2007 (UTC)

What image do you need? What is "Black" supposed to refer to? Andrwsc 17:47, 12 March 2007 (UTC)
Either a plain black flag or a black/red horizontal bicolor with red on the top and black on the bottom. (noth were used). I assumed this was the place to look because the opposite side had a "flagicon". Jacob Haller 17:57, 12 March 2007 (UTC)
Ah, well, if the flag image doesn't exist yet, then I'd suggest asking at Wikipedia:WikiProject Heraldry and vexillology or Commons:WikiProject Flags. Those folks are good with graphic editors etc. to create the correct SVG images. At this WikiProject, we're concerned with the maintenance of the templates that are used to render them in iconic form in articles. Hope this helps, Andrwsc 18:06, 12 March 2007 (UTC)