NAME

CLDR::Number::Format::Decimal - Localized decimal formatter using the Unicode CLDR

VERSION

This document describes CLDR::Number::Format::Decimal v0.02, built with the Unicode CLDR v24. This is an early release without full documentation. See CLDR::Number::TODO.

SYNOPSIS

# either
use CLDR::Number::Format::Decimal;
my $decf = CLDR::Number::Format::Decimal->new(locale => 'es');

# or
use CLDR::Number;
my $cldr = CLDR::Number->new(locale => 'es');
my $decf = $cldr->decimal_formatter;

say $decf->format(1234.5);  # '1 234,5' (Spanish)

$decf->locale('es-MX');
say $decf->format(1234.5);  # '1,234.5' (Mexican Spanish)

DESCRIPTION

Localized decimal formatter using the Unicode Common Locale Data Repository (CLDR).

Methods

All methods return character strings, not encoded byte strings.

format

Accepts a number and returns a formatted decimal, localized with the current locale.

at_least

Accepts a number and returns a formatted decimal for at least the supplied number.

say $decf->at_least(100);  # '100+'
range

Accepts two numbers and returns a formatted range of decimals.

say $decf->range(1, 10);  # '1–10'

Attributes

All string attributes are expected to be character strings. See also the common attributes in CLDR::Number.

pattern

Default: #,##0.### when root locale

minimum_integer_digits

Default: 1 when root locale

minimum_fraction_digits

Default: 0 when root locale

maximum_fraction_digits

Default: 3 when root locale

primary_grouping_size

Default: 3 when root locale

Not used when value is 0.

secondary_grouping_size

Default: 0 when root locale

Not used when value is 0.

rounding_increment

Default: 0 when root locale

0 and 1 are treated the same.

infinity

Default: when root locale

nan

Default: NaN when root locale

SEE ALSO

CLDR::Number

AUTHOR

Nick Patch <patch@cpan.org>

This project is brought to you by Perl CLDR and Shutterstock. Additional open source projects from Shutterstock can be found at code.shutterstock.com.

COPYRIGHT AND LICENSE

© 2013 Shutterstock, Inc.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.