NAME
Lingua::Num2Word - wrapper for number to text conversion modules of various languages in the Lingua:: hierarchy.
SYNOPSIS
use Lingua::Num2Word;
my $numbers = Lingua::Num2Word->new;
# try to use czech module (Lingua::CS::Num2Word) for conversion to text
my $text = $numbers->cardinal( 'cs', 123 );
# or procedural usage if you dislike OO
my $text = Lingua::Num2Word::cardinal( 'cs', 123 );
print $text || "sorry, can't convert this number into czech language.";
# check if number is in supported interval before conversion
my $number = 999_999_999_999;
my $limit = $numbers->get_interval('cs');
if ($limit) {
if ($number > $$limit[1] || $number < $$limit[0]) {
print "Number is outside of supported range - <$$limit[0], $$limit[1]>.";
} else {
print Lingua::Num2Word::cardinal( 'cs', $number );
}
} else {
print "Unsupported language.";
}
DESCRIPTION
Lingua::Num2Word is a module for converting numbers into their equivalent in written representation. This is a wrapper for various Lingua::XX::Num2Word modules that do the conversions for specific languages. Output encoding is utf-8.
For further information about various limitations of the specific modules see their documentation.
Functions
cardinal(lang,number)
Conversion from number to text representation in specified language.
get_interval(lang)
Returns the minimal and maximal number (inclusive) supported by the conversion in a specified language. The returned value is a list of two elements (low,high) or reference to this list depending on calling context. In case a unsupported language is passed undef is returned.
known_langs
List of all currently supported languages. Return value is list or reference to list depending to calling context.
langs
List of all known language codes from iso639. Return value is list or reference to list depending to calling context.
Language codes and names
Language codes and names from iso639 can be found at http://www.triacom.com/archive/iso639.en.html
EXPORT_OK
cardinal
get_interval
known_langs
langs
Required modules / supported languages
This module is only wrapper and require other cpan modules for requested conversions eg. Lingua::AF::Numbers for Afrikaans.
Currently supported languages/modules are:
af - Lingua::AF::Numbers
cs - Lingua::CS::Num2Word
de - Lingua::DE::Num2Word
en - Lingua::EN::Numbers
es - Lingua::ES::Numeros
eu - Lingua::EU::Numbers
fr - Lingua::FR::Numbers
in - see 'id'
it - Lingua::IT::Numbers
ja - Lingua::JA::Number
nl - Lingua::NL::Numbers
no - Lingua::NO::Num2Word
pl - Lingua::PL::Numbers
ru - Lingua::RU::Number
sv - Lingua::SV::Num2Word
zh - Lingua::ZH::Numbers
KNOWN BUGS
None.
AUTHOR
Roman Vasicek <rv@petamem.com>
COPYRIGHT
Copyright (c) 2002-2004 PetaMem s.r.o. - http://www.petamem.com/
This package is free software. You can redistribute and/or modify it under the same terms as Perl itself.