There is something very odd going on with the current version of countries, countries_i18n and the core's list of countries:

In core's locale.inc:

function country_get_list() {
  include_once DRUPAL_ROOT . '/includes/iso.inc';
  $countries = _country_get_predefined_list();
  // Allow other modules to modify the country list.
  drupal_alter('countries', $countries);
  return $countries;
}

The _country_get_predefined_list function returns a t() translated array of countries. But then the countries module implements hook_countries_alter(). This calls countries_get_countries which calls entity_load_multiple_by_name.

function countries_countries_alter(&$countries) {
$enabled_countries = &drupal_static(__FUNCTION__, array());
if (empty($enabled_countries)) {
$enabled_countries = countries_get_countries('name', array('enabled' => COUNTRIES_ENABLED));
}
$countries = array_intersect_key($enabled_countries, $countries);
$countries = array_merge($countries, array_diff_key($enabled_countries, $countries));
uasort($countries, 'countries_sort');
}
?>
Now I think the rest of the entity related stuff in countries_i18n is supposed to do the work of translating the county names (and other properties) but the translation never happens. It looks to me like a mix of i18n_strings and entity translation stuff. Maybe someone who knows either can sort this out. Or maybe I'm missing something?

Comments

Alan D.’s picture

I am not sure on how stable dev is, so in countries_get_countries replace:

  $mapped_countries = array();
  foreach ($filtered_countries as $country) {
    if (isset($country->$property)) {
      $mapped_countries[$country->iso2] = $country->$property;
    }
  }

with

  $mapped_countries = array();
  foreach ($filtered_countries as $country) {
    if (isset($country->$property)) {
      if ($property == 'name') {
        $mapped_countries[$country->iso2] = $country->label();
      }
      else {
        $mapped_countries[$country->iso2] = $country->$property;
      }
    }
  }

And this should hook into the i18n string translations.

This fix is already in the latest dev version.