Spanish Country Names

Author Message

Carlos Revillo

Wednesday 24 March 2010 4:18:06 am

Hi.

I've modified my esl-ES.ini file to include there the spanish names for countries. Names are taken via GeoNames WebService [1].

Work is based on ca_countrylist extension [2]. The idea behind adding names to esl.ES.ini is to add the possibility of having spanish names even if you don't use a ezcountry datatype

One possible use case is to present a list of countries for a 'geolocalized' search.

For getting the names i've written a little script that probably someone wants to use to get names in desired language. It looks like

<?php
require 'autoload.php';

$cli = eZCLI::instance();
$script = eZScript::instance( array( 'description' => ( "Take country names from GeoNames" ),
                                     'use-session' => false,
                                     'use-modules' => false,
                                     'use-extensions' => true ) );

$script->startup();

$script->initialize();

$dom = simplexml_load_file( 'http://ws.geonames.org/countryInfo?lang=ES&style=short' );

$countries = $dom->xpath( '//country' );
foreach( $countries as $country )
{
    $cli->output( 'Countries[' . (string)$country->countryCode .']=' . (string)$country->countryName );
}

$script->shutdown();
?>

Just change language param and it should work. Then copy + paste your result to your locale.ini file.

Best Regards.

[1] http://www.geonames.org

[2] http://projects.ez.no/ca_countrylist

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.