Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#17 | location.mf_.inc_.txt | 91 bytes | Pomliane |
#17 | location.patch | 3.72 KB | Pomliane |
#7 | location_iso3166update_0.patch | 18.93 KB | geodaniel |
#3 | location_iso3166update.patch | 16.72 KB | geodaniel |
Comments
Comment #1
geodaniel CreditAttribution: geodaniel commentedHmm, 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.
Comment #2
geodaniel CreditAttribution: geodaniel commentedComment #3
geodaniel CreditAttribution: geodaniel commentedI'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.
Comment #4
Tobias Maier CreditAttribution: Tobias Maier commentedwhat speaks against committing this?
Comment #5
geodaniel CreditAttribution: geodaniel commentedI'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.
Comment #6
ankur CreditAttribution: ankur commentedI 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
Comment #7
geodaniel CreditAttribution: geodaniel commentedUpdated 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.
Comment #8
geodaniel CreditAttribution: geodaniel commentedI'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).
Comment #9
stormsweeper CreditAttribution: stormsweeper commentedYou 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).
Comment #10
geodaniel CreditAttribution: geodaniel commentedJust 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?
Comment #11
berenddeboer CreditAttribution: berenddeboer commentedgeodaniel, 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.
Comment #12
bdragon CreditAttribution: bdragon commentedChanging component to Data update.
Comment #13
brmassa CreditAttribution: brmassa commentedDaniel,
fixed on HEAD. Soon on Location 3.
regards,
massa
Comment #14
geodaniel CreditAttribution: geodaniel commentedThanks... great to see you guys putting a breath of life into Location!
Comment #15
bdragon CreditAttribution: bdragon commentedYeah, I'm excited too!
A good week for geospatial in Drupal!
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #17
Pomliane CreditAttribution: Pomliane commentedHello,
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.
Comment #18
ankur CreditAttribution: ankur commentedYou should probably open a new one. Please close this one with a link to your new one when it's created.
Comment #19
Pomliane CreditAttribution: Pomliane commentedThanks for the advice ankur,
Here is the new issue: #939624: Saint-Martin missing in location.inc and errors in location.fr.inc