The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CLDR::Number::Format::Percent - Localized percent formatter using the Unicode CLDR

VERSION

This document describes CLDR::Number::Format::Percent v0.05, built with Unicode CLDR v24.

SYNOPSIS

    # either
    use CLDR::Number::Format::Percent;
    my $perf = CLDR::Number::Format::Percent->new(locale => 'tr');

    # or
    use CLDR::Number;
    my $cldr = CLDR::Number->new(locale => 'tr');
    my $perf = $cldr->percent_formatter;

    say $perf->format(0.05);  # '%5' (Turkish percent)

    $perf->locale('fr');
    say $perf->format(0.05);  # '5 %' (French percent)

    $perf->permil(1);
    say $perf->format(0.05);  # '50 ‰' (French per mil)

DESCRIPTION

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

Methods

format

Accepts a number and returns a formatted percent as a character string, localized with the current locale. If the permil attribute is true, returns per mil instead of percent.

Attributes

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

permil

Default: false (0)

percent_sign

Default: % when root locale

permil_sign

Default: when root locale

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: 0 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

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

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