The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Lingua::Any::Numbers - Converts numbers into (any available language) string.

SYNOPSIS

   use Lingua::Any::Numbers qw(:std);
   printf "Available languages are: %s\n", join( ", ", available );
   printf "%s\n", to_string(  45 );
   printf "%s\n", to_ordinal( 45 );

or test all available languages

   use Lingua::Any::Numbers qw(:std);
   foreach my $lang ( available ) {
      printf "%s\n", to_string(  45, $lang );
      printf "%s\n", to_ordinal( 45, $lang );
   }

DESCRIPTION

IMPORT PARAMETERS

All functions and aliases can be imported individually, but there are some pre-defined import tags:

   :all        Import everything (including aliases)
   :standard   available(), to_string(), to_ordinal().
   :std        Alias to :standard
   :standard2  available_languages(), to_string(), to_ordinal()
   :std2       Alias to :standard2
   :long       available_languages(), number_to_string(), number_to_ordinal()

IMPORT PRAGMAS

Some parameters enable/disable module features. + is prefixed to enable these options. Pragmas have global effect (i.e.: not lexical), they can not be disabled afterwards.

locale

Use the language from system locale:

   use Lingua::Any::Numbers qw(:std +locale);
   print to_string(81); # will use locale

However, the second parameter to the functions take precedence. If the language parameter is used, locale pragma will be discarded.

Install all the Lingua::*::Numbers modules to take advantage of the locale pragma.

It is also possible to enable locale usage through the functions. See "FUNCTIONS".

locale is implemented with I18N::LangTags::Detect.

FUNCTIONS

All language parameters (LANG) have a default value: EN. If it is set to LOCALE, then the language from the system locale will be used (if available).

to_string NUMBER [, LANG ]

Aliases:

num2str
number_to_string

to_ordinal NUMBER [, LANG ]

Aliases:

num2ord
number_to_ordinal

available

Returns a list of available language ids.

Aliases:

available_langs
available_languages

DEBUGGING

SILENT

If you define a sub named Lingua::Any::Numbers::SILENT and return a true value from that, then the module will not generate any warnings when it faces some recoverable errors.

Lingua::Any::Numbers::SILENT is not defined by default.

CAVEATS

  • Some modules return UTF8, while others return arbitrary encodings. ascii is ok, but others will be problematic. A future release can convert all to UTF8.

  • All available modules will immediately be searched and loaded into memory (before using any function).

  • No language module (except Lingua::EN::Numbers) is required by Lingua::Any::Numbers, so you'll need to install the other modules manually.

SEE ALSO

Lingua::AF::Numbers, Lingua::EN::Numbers, Lingua::EU::Numbers, Lingua::FR::Numbers, Lingua::HU::Numbers, Lingua::IT::Numbers, Lingua::JA::Numbers, Lingua::NL::Numbers, Lingua::PL::Numbers, Lingua::TR::Numbers, Lingua::ZH::Numbers.

SUPPORT

BUG REPORTS

All bug reports and wishlist items must be reported via the CPAN RT system. It is accessible at http://rt.cpan.org/NoAuth/Bugs.html?Dist=Lingua-Any-Numbers.

DISCUSSION FORUM

CPAN::Forum is a place for discussing CPAN modules. It also has a Lingua::Any::Numbers section at http://www.cpanforum.com/dist/Lingua-Any-Numbers.

RATINGS

If you like or hate or have some suggestions about Lingua::Any::Numbers, you can comment/rate the distribution via the CPAN Ratings system: http://cpanratings.perl.org/dist/Lingua-Any-Numbers.

AUTHOR

Burak Gürsoy, <burak@cpan.org>

COPYRIGHT

Copyright 2007-2008 Burak Gürsoy. All rights reserved.

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 391:

Non-ASCII character seen before =encoding in 'Gürsoy,'. Assuming CP1252