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.

eZ debug

Timing: Jan 18 2025 02:57:56
Script start
Timing: Jan 18 2025 02:57:56
Module start 'layout'
Timing: Jan 18 2025 02:57:56
Module start 'content'
Timing: Jan 18 2025 02:57:56
Module end 'content'
Timing: Jan 18 2025 02:57:56
Script end

Main resources:

Total runtime0.0827 sec
Peak memory usage4,096.0000 KB
Database Queries48

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.0391152.6250
Module start 'layout' 0.00460.0026 740.664139.4453
Module start 'content' 0.00720.0741 780.1094409.3984
Module end 'content' 0.08130.0013 1,189.50788.1641
Script end 0.0826  1,197.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00313.8077160.0002
Check MTime0.00121.4737160.0001
Mysql Total
Database connection0.00060.704110.0006
Mysqli_queries0.046355.9685480.0010
Looping result0.00040.4537460.0000
Template Total0.056668.420.0283
Template load0.00202.415720.0010
Template processing0.054666.000620.0273
Template load and register function0.00020.223810.0002
states
state_id_array0.00050.591610.0005
state_identifier_array0.00060.782820.0003
Override
Cache load0.00161.9623130.0001
Sytem overhead
Fetch class attribute can translate value0.00050.643810.0005
Fetch class attribute name0.00070.849510.0007
XML
Image XML parsing0.00010.164410.0001
class_abstraction
Instantiating content class attribute0.00000.004910.0000
General
dbfile0.00161.8786100.0002
String conversion0.00000.006140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 6
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs