NAME

CLDR::Number::Format::Currency - Localized currency formatter using the Unicode CLDR

VERSION

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

SYNOPSIS

# either
use CLDR::Number::Format::Currency;
my $curf = CLDR::Number::Format::Currency->new(
    locale   => 'en',
    currency => 'USD',
);

# or
use CLDR::Number;
my $cldr = CLDR::Number->new(locale => 'en');
my $curf = $cldr->currency_formatter(currency_code => 'USD');

say $curf->format(9.99);  # '$9.99' (English / USD)

$curf->locale('en-CA');
say $curf->format(9.99);  # 'US$9.99' (Canadian English / USD)

$curf->locale('fr-CA');
say $curf->format(9.99);  # '9,99 $US' (Canadian French / USD)

DESCRIPTION

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

Methods

format

Accepts a number and returns a formatted currency value as a character string, using the currency from the currency_code attribute and localized with the current locale.

Attributes

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

currency_code

Default: none

currency_sign

Default: none

cash

Default: false (0)

pattern

Default: ¤ #,##0.00 when root locale

minimum_integer_digits

Default: 1 when root locale

minimum_fraction_digits

Default: 2 when root locale

maximum_fraction_digits

Default: 2 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.

SEE ALSO

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–2014 Shutterstock, Inc.

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