The geonames module in its current implementation seems quite oriented to US / English websites only. It would be nice if the alternate names (in other languages) of countries would also get imported into the database and taken into account when using geonames_countries() or geonames_countryinfo().

Comments

lyricnz’s picture

Status: Active » Closed (won't fix)

The geonames_countries() and geonames_countryinfo() functions simply make use of the data retrieved from http://download.geonames.org/export/dump/countryInfo.txt

This file only contains English - there's nothing we can do about that.

cyberwolf’s picture

Hi lyricnz

GeoNames does offer the country names in different languages though, through their webservices. For example, all variants of the USA are listed here: http://www.geonames.org/US/other-names-for-united-states.html, this information can be retrieved with the web service http://api.geonames.org/countryInfoCSV?lang=it&country=USA&username=demo, simply replace the "it" in lang=it with the language you want the country info in.

The file they offer as a download probably has its (limited) purposes, but from a Drupal module offering an API to GeoNames I'd expect to keep internationalization in mind.

I found a workaround, by querying the webservices with the API this module offers:

global $language;
$countries = geonames_query('countryinfo', array('lang' => $language->language), array('columns' => array('countrycode', 'countryname'), 'sortby' => 'countryname'));
lyricnz’s picture

Status: Closed (won't fix) » Postponed (maintainer needs more info)

Feel free to provide a patch that implements a user-friendly wrapper for this.

user654’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

.

lyricnz’s picture

Does the query provided in #2 work for you? The data stored in countryinfo table in geonames module isn't much used, the query is better. Results are cached, which should help with performance.

user654’s picture

.

lyricnz’s picture

I don't know how you intend to do this reference, but it would be pretty easy to make a contrib module that saves whatever results you need. Sounds like you'd need to get into code development for this reference anyway?

user654’s picture

.

avpaderno’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active