Git Product home page Git Product logo

locale-places's Introduction

NAME

Locale::Places - Translate places between different languages using http://download.geonames.org/

VERSION

Version 0.12

SYNOPSIS

Translates places between different languages, for example London is Londres in French.

METHODS

new

Create a Locale::Places object.

Takes one optional parameter, directory, which tells the object where to directory containing GB.sql and US.sql If that parameter isn't given, the module will attempt to find the databases, but that can't be guaranteed. Any other options are passed to the underlying database driver.

translate

Translate a city into a different language. Takes one mandatory argument: 'place'. It also takes two other arguments: 'from' and 'to', at least one of which must be given. If neither $to nor $from is given, the code makes a best guess based on the environment. If no translation can be found, returns place in the original language. Takes an optional argument 'country' which can be either GB (the default) or US which is the country of that 'place' is in.

use Locale::Places;

# Prints "Douvres"
print Locale::Places->new()->translate({ place => 'Dover', country => 'GB', from => 'en', to => 'fr' });

# Prints "Douvres" if we're working on a French system
print Locale::Places->new()->translate('Dover');

AUTOLOAD

Translate to the given language, where the routine's name will be the target language.

# Prints 'Virginie', since that's Virginia in French
print $places->fr({ place => 'Virginia', from => 'en', country => 'US' });

AUTHOR

Nigel Horne, <njh at bandsman.co.uk>

BUGS

Only supports places in GB and US at the moment.

Canterbury no longer translates to Cantorbéry in French. This is a problem with the data, which has this line:

16324587    2653877 fr      Canterbury      1

which overrides the translation by setting the 'isPreferredName' flag

SEE ALSO

Locale::Country::Multilingual to translate country names.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Locale::Places

You can also look for information at:

LICENCE AND COPYRIGHT

Copyright 2020-2024 Nigel Horne.

This program is released under the following licence: GPL2

This product uses data from geonames, http://download.geonames.org.

locale-places's People

Contributors

dependabot[bot] avatar nigelhorne avatar

Watchers

 avatar  avatar  avatar

locale-places's Issues

Failed test 'Locale::Places::GB->new() died'

The test suite of Locale-Places-0.13 fails on all of my smokers:

#   Failed test 'Locale::Places::GB->new() died'
#   at t/gb.t line 21.
#     Error was:  Locale::Places::GB: lib/Locale/Places/data is not a directory at /usr/perl5.40.0/lib/5.40.0/Test/More.pm line 741.
Can't call method "fetchrow_hashref" on an undefined value at t/gb.t line 25.
# Looks like your test exited with 21 just after 3.
t/gb.t ................ 
Dubious, test returned 21 (wstat 5376, 0x1500)
Failed 4/6 subtests 
...
Locale::Places::GB: /home/cpansand/.cpan/build/2024071911/Locale-Places-0.13-1/blib/lib/Locale/Places/data is not a directory at /home/cpansand/.cpan/build/2024071911/Locale-Places-0.13-1/blib/lib/Locale/Places.pm line 153.
# Looks like your test exited with 2 just after 2.
t/translate.t ......... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 23/25 subtests 
...
#   Failed test 'Locale::Places::US->new() died'
#   at t/us.t line 21.
#     Error was:  Locale::Places::US: lib/Locale/Places/data is not a directory at /usr/perl5.40.0/lib/5.40.0/Test/More.pm line 741.
Can't call method "fetchrow_hashref" on an undefined value at t/us.t line 25.
# Looks like your test exited with 21 just after 3.
t/us.t ................ 
Dubious, test returned 21 (wstat 5376, 0x1500)
Failed 4/6 subtests 
...

Endless loop with warnings in test suite

Currently all my smokers fill up when building Locale-Places-0.09. The logs repeat the following line:

Use of uninitialized value $headers[9] in hash slice at /opt/perl-5.30.3/lib/site_perl/5.30.3/Text/xSV/Slurp.pm line 651, <$handle> line 10342.

Investigate CPAN failures

http://www.cpantesters.org/cpan/report/47923180-216c-11ef-abf5-d5346e8775ea

t/eof.t ............... skipped: Need Test::EOF
t/eol.t ............... skipped: Author tests not required for installation

#   Failed test 'Locale::Places::GB->new() died'
#   at t/gb.t line 21.
#     Error was:  Locale::Places::GB: lib/Locale/Places/data is not a directory at /usr/perl5.39.9/lib/site_perl/5.39.9/Test/More.pm line 741.
Can't call method "fetchrow_hashref" on an undefined value at t/gb.t line 25.
# Looks like your test exited with 21 just after 3.
t/gb.t ................ 
Dubious, test returned 21 (wstat 5376, 0x1500)
Failed 4/6 subtests 
t/kwalitee.t .......... skipped: Author tests not required for installation
t/links.t ............. skipped: Author tests not required for installation
t/manifest.t .......... skipped: Author tests not required for installation
t/minimum.t ........... skipped: Author tests not required for installation
t/no404s.t ............ skipped: Author tests not required for installation
# Author tests not required for installation
# Author tests not required for installation
t/noopentickets.t ..... ok
t/noplan.t ............ skipped: Author tests not required for installation
t/pod-cm.t ............ ok
t/pod-spelling.t ...... skipped: Author tests not required for installation
t/pod-synopsis.t ...... skipped: Need Test::Synopsis
t/pod.t ............... skipped: Author tests not required for installation
t/port.t .............. ok
t/snippets.t .......... skipped: Author tests not required for installation
t/strict.t ............ skipped: Author tests not required for installation
Locale::Places::GB: /home/cpansand/.cpan/build/2024060201/Locale-Places-0.12-1/blib/lib/Locale/Places/data is not a directory at /home/cpansand/.cpan/build/2024060201/Locale-Places-0.12-1/blib/lib/Locale/Places.pm line 153.
# Looks like your test exited with 2 just after 2.
t/translate.t ......... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 23/25 subtests 
t/unused.t ............ skipped: Author tests not required for installation

#   Failed test 'Locale::Places::US->new() died'
#   at t/us.t line 21.
#     Error was:  Locale::Places::US: lib/Locale/Places/data is not a directory at /usr/perl5.39.9/lib/site_perl/5.39.9/Test/More.pm line 741.
Can't call method "fetchrow_hashref" on an undefined value at t/us.t line 25.
# Looks like your test exited with 21 just after 3.
t/us.t ................ 
Dubious, test returned 21 (wstat 5376, 0x1500)
Failed 4/6 subtests 
t/vars.t .............. skipped: Need Test::Vars

Undeclared dependencies

The test suite fails if some modules are not installed:

  • DBD::SQLite::Constants
  • Error::Simple

Additionally modules are needed in the Makefile.PL phase and thus need to be specified as configure_requires:

  • LWP::Simple

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.