hi there, i've got a question on geonames (i think it belongs here). i use it together with gmaps to apply addresses and/or lon/lat to nodes. when using the fulltext-search to find a place, the service does find german spelled places like "konstanz" easily but then the result is always displayed in englisch ("Constance, Germany"). could it be somehow achieved to display results in different languages?

Comments

thommyboy’s picture

search on http://www.geonames.org itself does display the results in german...

lyricnz’s picture

I don't know how your module uses the this module, but the geonames module simply wraps results returned by the geonames.org webservices. By default, in the case of search:

$query = array('query' => 'konstanz');
$results = geonames_query('search', $query);
print_r($results);

We just get back structured data straight for the service:

...
    [results] => Array
        (
            [0] => Array
                (
                    [name] => Konstanz
                    [lat] => 47.6666667
                    [lng] => 9.1833333
                    [geonameid] => 2885679
                    [countrycode] => DE
                    [fcl] => P
                    [fcode] => PPL
                    [distance] => 
                )

        )
...

According to the geonames documentation for the "search" service at http://www.geonames.org/export/geonames-search.html - you can pass a language parameter:


lang
string ISO-636 2-letter language code; en,de,fr,it,es,... (optional)
place name and country name will be returned in the specified language. Default is English. Feature classes and codes are only available in English and Bulgarian. Any help in translating is welcome.

So using PHP like:

$query = array('query' => 'konstanz', 'lang' => 'de');
$results = geonames_query('search', $query);
print_r($results);

I this case, the result is exactly the same as above. Perhaps your integration is using the "get" service to get more information about the results? Again, you can use that with the "lang" parameter:

$query = array('geonameid' => $results->results[0]['geonameid'], 'lang' => 'de');
$one = geonames_query('get', $query);
print_r($one);

delivering a result like:

...
    [results] => Array
        (
            [0] => Array
                (
                    [name] => Konstanz
                    [lat] => 47.6666667
                    [lng] => 9.1833333
                    [geonameid] => 2885679
                    [countrycode] => DE
                    [countryname] => Deutschland
                    [fcl] => P
                    [fcode] => PPL
                    [fclname] => city, village,...
                    [fcodename] => populated place
                    [population] => 81275
                    [alternatenames] => Constanca,Constance,Constanta,Constanza,Constança,Constanţa,Costanza,Konstancja,Konstanz,Kostnice,קונסטנץ,コンスタンツ,康斯坦茨
                    [elevation] => 
                    [continentcode] => EU
                    [admincode1] => 01
                    [adminname1] => südwestdeutschland
                    [admincode2] => 
                    [adminname2] => 
                    [alternatename] => 康斯坦茨
                    [timezone] => Europe/Berlin
                )

        )
...

Hope this helps. If it does, please close this issue.

thommyboy’s picture

Status: Active » Closed (fixed)

hi lyricnz,
thanks for your quick answer! so this would be exactly what i would like to get as a result but in my configuration i input "konstanz" and the result is "constance" so I get everything in english. so you think it's an issue for drupal.org/project/gmaps where they use it- maybe they don't pass the $lang? found another issue there that seems to be a duplicate http://drupal.org/node/346413. thanks tom