There are countries in the official ISO3166-1 list that don't show up in the list of countries in the location module (Isle of Man would be one of them). We should make sure this is up to date according to the current version of the standard.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

geodaniel’s picture

Title: Ensure ISO3166 list is up to date » Ensure ISO3166 list is up to date and ordered by country name not code

Hmm, whilst doing that, perhaps we should order those countries alphabetically by name instead of by country code. That should make them appear in the right order to users, for whom the current list causes constant confusion. Think, for example, about 'Germany' between Czech Republic and Djibouti (due to its 'de' code) instead of between Georgia and Ghana where it should fit naturally.

geodaniel’s picture

Version: 4.7.x-1.x-dev » 6.x-3.x-dev
geodaniel’s picture

Assigned: Unassigned » geodaniel
Status: Active » Needs review
FileSize
16.72 KB

I've attached a patch with a new country list based on the data at http://download.geonames.org/export/dump/countryInfo.txt (CC attribution license), sorted by country name.

There are a number of new additions (Guernsey (gg), Isle of Man (im), Jersey (je), Montenegro (me), Serbia (rs)), some codes that differ from the existing setup (Sweden (sw vs. se), United Kingdom (changed to uk)) and some that just seem to be missing .inc files (Lebanon (lb), Niger (ne)). We still need to add .inc files where necessary.

Tobias Maier’s picture

Status: Needs review » Reviewed & tested by the community

what speaks against committing this?

geodaniel’s picture

Status: Reviewed & tested by the community » Needs review

I'm not completely happy committing this as there is still an outstanding issue with the likes of Sweden. What should we do with data that had already been entered as sw. Should that be changed to se? What if people have written code based on that in their local system?

There were no comments on the original sw vs. se issue I opened a year ago, so perhaps we don't need to worry so much, but I think we should weigh up some options.

ankur’s picture

I think the appropriate way to deal w/ this would be to have, in the same revision, an extra function in the location.install file that does an 'UPDATE {location} SET country = 'sw' WHERE country = 'se'

As for people possibly having written code dependent on the hard-coding of a country code -- Ideally, I should be making this thing maintain a changelog for that kinda thing, with a drupal set message in the _update() function describing what changed.

Also, another reason the function is a little off is that I explicity decided to go w/ the ICANN domain letters for a country instead of the ISO but never changed the name of the function. I just couldn't imagine have 'gb' in place of 'uk' for the United Kingdom just because I'm used to seeing ".uk" on the end of a UK domain... I know; it sounds silly.

-Ankur

geodaniel’s picture

Updated version of the patch attached, with the sw -> sw database update included (update 6). I've also renamed the sw file to se, leaving a comment for now in the old one in case anyone's wondering what happened. In addition, I've created stub files for gg, im, je, me, rs, lb and ne (Geonames doesn't list any administrative regions for any of these at the moment).

If there are no issues that anybody spots, I'll go ahead and commit this.

geodaniel’s picture

Status: Needs review » Reviewed & tested by the community

I've committed the changes to location.inc, location.install and location.sw.inc on HEAD, DRUPAL-4-7, DRUPAL-5.

I've also added the stub location includes to HEAD and DRUPAL-5, and am trying to figure out how to add them to DRUPAL-4-7 too (I think CVS is choking because I messed up the original commit of the files on DRUPAL-4-7 branch).

stormsweeper’s picture

ankur: Also, another reason the function is a little off is that I explicity decided to go w/ the ICANN domain letters for a country instead of the ISO but never changed the name of the function. I just couldn't imagine have 'gb' in place of 'uk' for the United Kingdom just because I'm used to seeing ".uk" on the end of a UK domain... I know; it sounds silly.

You may want to add this to the README or somewhere else prominently. The gb code is in very common use, and this can cause a hiccup for integrating other systems that use ISO3166-1 (e.g. the "Accept-Language" HTTP header).

geodaniel’s picture

Status: Reviewed & tested by the community » Needs review

Just noticed that the ordering of the countries in location.inc seems to have reverted to the list sorted by country code instead of country name as of 1.45.2.5... is it intentional, or is it ok if I go in and fix it up again?

berenddeboer’s picture

geodaniel, your original patch worked great. I'm guessing no one uses the location module, sorting countries by iso code is extremely confusing for ordinary users.

bdragon’s picture

Component: Code » Data update

Changing component to Data update.

brmassa’s picture

Status: Needs review » Fixed

Daniel,

fixed on HEAD. Soon on Location 3.

regards,

massa

geodaniel’s picture

Thanks... great to see you guys putting a breath of life into Location!

bdragon’s picture

Yeah, I'm excited too!

A good week for geospatial in Drupal!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Pomliane’s picture

Version: 6.x-3.x-dev » 6.x-3.1
Assigned: geodaniel » Unassigned
Priority: Normal » Major
Status: Closed (fixed) » Active
FileSize
3.72 KB
91 bytes

Hello,

Saint-Martin was missing and there were errors in location.fr.inc (missing characters).

Is this generic issue the good one to submit reports and patches?
Should I open a new issue?

Thanks in advance.

ankur’s picture

You should probably open a new one. Please close this one with a link to your new one when it's created.

Pomliane’s picture

Status: Active » Closed (fixed)

Thanks for the advice ankur,
Here is the new issue: #939624: Saint-Martin missing in location.inc and errors in location.fr.inc