Permalink
Browse files

Sync country_select with ISO 3166 long names. Closes #6872 [abhay, mi…

…kong, ruben]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7904 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 347b911 commit 3353b85b0eae76bf36ae7c2f7b6adc1863278a8e @NZKoz NZKoz committed Oct 15, 2007
@@ -252,13 +252,7 @@ def country_options_for_select(selected = nil, priority_countries = nil)
country_options += "<option value=\"\">-------------</option>\n"
end
- if priority_countries && priority_countries.include?(selected)
- country_options += options_for_select(COUNTRIES - priority_countries, selected)
- else
- country_options += options_for_select(COUNTRIES, selected)
- end
-
- return country_options
+ return country_options + options_for_select(COUNTRIES, selected)
end
# Returns a string of option tags for pretty much any time zone in the
@@ -314,50 +308,44 @@ def option_value_selected?(value, selected)
end
# All the countries included in the country_options output.
- COUNTRIES = [ "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla",
- "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia",
- "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus",
- "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina",
- "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory",
- "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burma", "Burundi", "Cambodia",
- "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic",
- "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia",
- "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands",
- "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark",
- "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt",
- "El Salvador", "England", "Equatorial Guinea", "Eritrea", "Espana", "Estonia",
- "Ethiopia", "Falkland Islands", "Faroe Islands", "Fiji", "Finland", "France",
- "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia",
- "Georgia", "Germany", "Ghana", "Gibraltar", "Great Britain", "Greece", "Greenland",
- "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana",
- "Haiti", "Heard and Mc Donald Islands", "Honduras", "Hong Kong", "Hungary", "Iceland",
- "India", "Indonesia", "Ireland", "Israel", "Italy", "Iran", "Iraq", "Jamaica", "Japan", "Jordan",
- "Kazakhstan", "Kenya", "Kiribati", "Korea, Republic of", "Korea (South)", "Kuwait",
- "Kyrgyzstan", "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho",
- "Liberia", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia",
- "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands",
- "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico",
- "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia",
- "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal",
- "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua",
- "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Ireland",
- "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama",
- "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland",
- "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russia", "Rwanda",
- "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines",
- "Samoa (Independent)", "San Marino", "Sao Tome and Principe", "Saudi Arabia",
- "Scotland", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore",
- "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
- "South Georgia and the South Sandwich Islands", "South Korea", "Spain", "Sri Lanka",
- "St. Helena", "St. Pierre and Miquelon", "Suriname", "Svalbard and Jan Mayen Islands",
- "Swaziland", "Sweden", "Switzerland", "Taiwan", "Tajikistan", "Tanzania", "Thailand",
- "Togo", "Tokelau", "Tonga", "Trinidad", "Trinidad and Tobago", "Tunisia", "Turkey",
- "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine",
- "United Arab Emirates", "United Kingdom", "United States",
- "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu",
- "Vatican City State (Holy See)", "Venezuela", "Viet Nam", "Virgin Islands (British)",
- "Virgin Islands (U.S.)", "Wales", "Wallis and Futuna Islands", "Western Sahara",
- "Yemen", "Zambia", "Zimbabwe" ] unless const_defined?("COUNTRIES")
+ COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola",
+ "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria",
+ "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
+ "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil",
+ "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia",
+ "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
+ "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
+ "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba",
+ "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt",
+ "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)",
+ "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia",
+ "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar",
+ "Great Britain", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea",
+ "Guinea-Bissau", "Guyana", "Haiti", "Heard and McDonald Islands", "Holy See (Vatican City State)",
+ "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq",
+ "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya",
+ "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan",
+ "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya",
+ "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of",
+ "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique",
+ "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of",
+ "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru",
+ "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger",
+ "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau",
+ "Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
+ "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation",
+ "Rwanda", "Saint Barthelemy", "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia",
+ "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino",
+ "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore",
+ "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
+ "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname",
+ "Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic",
+ "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste",
@jamis
jamis Sep 18, 2008 Contributor

I know “Taiwan, Province of China” is the official ISO 3166 long name for Taiwan, but calling it a “province of china” is pretty politically charged. Any chance we could change that to simply “Taiwan”? I know at one point Google Maps labeled “Taiwan” as “Taiwan, Province of China”, but these days they simply label it Taiwan. It seems the less provocative thing to do.

+ "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
+ "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom",
+ "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela",
+ "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis and Futuna", "Western Sahara",
+ "Yemen", "Zambia", "Zimbabwe"] unless const_defined?("COUNTRIES")
end
class InstanceTag #:nodoc:
@@ -384,7 +372,12 @@ def to_country_select_tag(priority_countries, options, html_options)
html_options = html_options.stringify_keys
add_default_name_and_id(html_options)
value = value(object)
- content_tag("select", add_options(country_options_for_select(value, priority_countries), options, value), html_options)
+ content_tag("select",
+ add_options(
+ country_options_for_select(value, priority_countries),
+ options, value
+ ), html_options
+ )
end
def to_time_zone_select_tag(priority_zones, options, html_options)
Oops, something went wrong.

24 comments on commit 3353b85

@hlb
hlb commented on 3353b85 Sep 18, 2008

Thank you, jamis. “Taiwan” is a better name for us who live here, less provocative, and much happier.

@xdite
xdite commented on 3353b85 Sep 18, 2008

Taiwan belongs Republic of China, Not Province of China.

“Taiwan” is a better name for us who live here. I live in Taiwan, and I don’t think Taiwan belongs Province of China.

Please don’t try to do this to insult us. Taiwan and PROC are two different countries.

@ihower
Contributor
ihower commented on 3353b85 Sep 18, 2008

yes, “Taiwan” is much much better for us who live here.

@lukhnos

I’m shocked and appalled by the change.

Please revert the entry for Taiwan to “Taiwan”, which follows the standard practice of every major, important and recognized web site and software service of the world. Neither Amazon, IBM, Microsoft or Apple, to name a few, uses the term above in the latest commit.

@gugod
gugod commented on 3353b85 Sep 18, 2008

None of Taiwanese address themselves as people from “Taiwan, province of china”.

Although the ISO FAQ at http://is.gd/2NRv pointed out that this name is politically neutral, their answer is paradoxical. The neutrality is only defined within UN members, not counting Taiwan, but China.

There is nothing wrong that Taiwan is not a member of UN, expect that we passionate hackers living on this island has been explaining such fact to all the open source community in the world that we shouldn’t be addressed by that long incorrect name.

Please, the name of this beautiful island is just “Taiwan”.

@seamxr
seamxr commented on 3353b85 Sep 18, 2008

From Taiwanese perspective. I always refuse to visit a Web site or a community who shows me the name of my country that out of my expectation.
Please revert the entry back to “Taiwan”, or I will not able to visit a site which make by RoR bcoz I can not find my country in the list. I think most of Taiwanese will do so.

@pesty
pesty commented on 3353b85 Sep 18, 2008

I don’t see any benefit for the community to get involved into this highly controversial issue. The name itself is very political and brings nothing but argument. No one would ever introduce his friends from Taiwan as “from Taiwan, Province of China”, so why bother to use this name anyway? To keep it simple and clear, “Taiwan” is definitely better than this garrulous term.

@landrew

I’m not Taiwanese, but I am not a fan of the way that Taiwan gets bullied by China in the UN. Are we letting Taiwan get bullied in the Rails codebase now too? The best bet is to follow the example of Google and many other tech companies and keep the name as “Taiwan”, not “Taiwan, Province of China.”

@itszero

I’m also support the original name of Taiwan, it’s just “Taiwan”.

In this way, we could not only avoid the political manners, but also this name is already known by everyone in the world. Using the “Taiwan, Province of China” could cause many confuse among the users (I means the end-user, not our “Rails Developer/User”).

Please, revert it back to Taiwan.

@NZKoz
Member
NZKoz commented on 3353b85 Sep 18, 2008

We’ve taken this list from an ISO standard. The issues about UN governance and constitutional issues are well beyond what we can resolve with a single patch.

If we change this one case for Taiwan, what of Kosovo, South Ossetia, Abkhazia, Transnistria, Kurdish Turkey?

The list goes on.

Frankly I’d prefer to just rip this functionality out entirely and let people make their own lists.

@sjh
sjh commented on 3353b85 Sep 18, 2008

We are people living in Taiwan which is NOT a province of China.

I don’t think any ISO standard can be counted as legit basis for you to call
others by incorrect nationality.

People who live in Taiwan have our own nationality as Taiwan and Taiwan
is NOT province of china but another country nearby china.

@scottymac

The inclusion of this list and its contents is not a political statement, but simply a convenience for developers. Given that this can easily be altered by the Rails developer to suit his/her needs, and, in the interest of saving time and effort in mediating this or future disputes over country names, a standard should be adhered to, even if the standard is inaccurate. Either that, or, as Koz mentioned, it should be removed entirely.

@pesty
pesty commented on 3353b85 Sep 18, 2008

Funny is, none of the country / region you mentioned is in the list. Most people will accept the name you mentioned above as long as the list is referring to countries/regions.

@lukhnos

NZKoz,

I beg to differ. You are not really answering to the issue, only beating around the bush.

You made a profound change that affects all existing web sites built upon the code, and you based your decision on that you’re syncing with a standard, which in practice and in reality is not used per se (cf. those companies I mentioned above and their policies on this issue). And your change has posed a problem to developers, web sites that built on Rails, and users of those web sites.

And I don’t think you’re proposing a practical solution other than being cynical. You know very clearly that this part of the code has been there in Rails since long and probably will stay, and many sites are built upon it.

If the list had a typo, I’m sure you’d have no problem fixing it presto. Writing “Taiwan, Province of China” is like writing a typo, because no Taiwanese would use that term to call where they are from.

We demand respect on this issue.

@NZKoz
Member
NZKoz commented on 3353b85 Sep 18, 2008

We have removed the list of countries entirely from rails as of today:

http://github.com/rails/rails/commit/2d27b82d4cf446543539ad20afcbad256d8aeff7

The country_select plugin reflects the iso 3166 list exactly and is now clearly documented as such. If that list isn’t suitable for you, you can make your own plugin which reflects your situation more accurately.

I’m not interested in having a political discussion on this issue. The ISO 3166 list doesn’t reflect my political views on this matter, or many others. But open source is not the place for us to make a statement either way. Please don’t take this personally, or as me being some apologist for the PRC.

There’s no resolution to this issue which doesn’t offend someone, this is merely the least-bad option.

Perhaps we all need to take a walk outside for a while and be grateful that we live in countries that give us access to the internet without censorship and monitoring, and have the financial means to afford internet access, and computers.

@lukhnos

NZKoz,

I appreciate your efforts in trying to come up with a solution. But still, the country_select plug in will be the next problem.

I assume civility is about that, if you are referring to someone, you use the term that he or she feels comfortable with. If we follow your logic, we might still be using many problematic terms to refer to many people in the world, simply because, say, Webster 2nd ed. is the standard.

Also I assume we all appreciate that we are able to enjoy the freedom and the means to the freedom. I assume we all appreciate that we can participate in an open source project and enjoy the fruits that it bear.

If open source is about participation, I suggest that respect is an important element, and respecting the people that a term you use refer to is part of it.

Compromises have been made in many other open source projects. All I’m trying to say is that you’re not finding a good one, still leaving the problem to the plug-in. And you know many people will just use the plug-in. It’s not a practical or constructive solution.

Please use Taiwan to refer to people who live there, not Taiwan, Province of China.

@eltiare

lukhnos: Respecting everything that others want is quite an impractical order on a global scale. If you try to make everyone happy, someone is not going to like it. Since the list is scraped from another source, one cannot individually maintain country names without it turning into a nightmare to maintain. It’s not political, it’s practical. Since the list is provided for convenience only, I don’t think it fair to the maintainers to have to do a whole bunch of work every time that someone has a gripe with list item. If you can suggest a different list to use that would make a good replacement, perhaps that is the better solution.

@nesquena

I think the best idea is what has been done. Extract to a plugin. Maybe have “classic” country list and the “standards” country list. Never have to change them unless the standard changes and then anyone can feel free to make their own custom versions that suit their needs.

@supaspoida

This seems silly to me. It is trivial for anybody with an issue with the standard to just load up an initializer that changes that particular item when your application starts.

@pjjw
pjjw commented on 3353b85 Sep 18, 2008

nzkoz: the examples that you listed are far more ephemeral than taiwan. it’s a clear outlier here. i understand your perspective about non-involvement, but the entire world calls it just “taiwan,” and everyone seems to be cool with it.

@gilesbowkett
Contributor

I would say take out the province of China thing since it offends so many people. Also, the “what about Kosovo?” argument, well, that’s a what if, the whole point of Getting Real is very anti-what-if. Deal with that if and when it happens. Worst-case scenario, you build a trivial polling app.

Alternatively, dump it out to a plugin and let anybody who complains enough fork the damn thing. That way people can decide based on which fork they use, and you don’t have to care.

By the way, I admit to political bias. Hong Kong movies have gone to shit since Beijing took over. The PROC are evil, almost as evil as the US govmt, and their kung fu sucks.

@tvandervossen

Just remove the list.

@giro54
giro54 commented on 3353b85 Sep 18, 2008

First, the list gets updated. Later, the whole functionality gets removed. If the helper wasn’t useful at all, why did we even care about ISO/UN standards?

@lifo
Member
lifo commented on 3353b85 Sep 18, 2008

Ok. Lets all stop posting here now. country_select has already been converted to a plugin1 and removed from rails2

Lets keep the discussion here purely technical. I’ll be deleting any comments that are about selecting the color of the bikeshed.

Thanks.

1 http://github.com/rails/country_select/tree
2 http://github.com/rails/rails/commit/2d27b82d4cf446543539ad20afcbad256d8aeff7

Please sign in to comment.