Greetings,

I have another issue with the module. While installing on a default Drupal instance, the country names are all wrong because the module copies the Drupal country name from includes/iso.inc. The problem is that some of these countries have wrong names since they are neither short nor long official name. Take for instance:

'CD' => $t('Congo (Kinshasa)'),
'CG' => $t('Congo (Brazzaville)'),
'VA' => $t('Vatican'),

Attaching a patch for this.
I'm not sure here is the correct fix, maybe this should be reported to Drupal core?

CommentFileSizeAuthor
0001-use_name_from_csv.patch405 bytescristiroma
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alan D.’s picture

Category: bug » feature

That was a deliberate design decision not to overwrite by default, but a message linking to the update page would probably be a good idea.

/**
 * Implements hook_install().
 */
function countries_install() {
  // Import the data.
  countries_import_csv();
  $t = get_t();
  drupal_set_message($t('Visit the countries !config_page to import the most recent changes from the ISO 3166-1 standard.',
    array(
      '!config_page' => l($t('configuration page'), 'admin/config/regional/countries/import'),
    )));
}
Alan D.’s picture

Component: Code » User interface
Status: Active » Fixed

Committed the above code.

Status: Fixed » Closed (fixed)

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

vinmassaro’s picture

Is there a way I can perform the countries update programmatically? I have a feature that depends on countries and imports country data from an external source. It would be great if there was a way to automatically update the countries in code when my module is enabled, so the country data is up to date before the import happens, otherwise mappings will be off. Thanks in advance.