CLDR::Number::Format::Percent - Localized percent formatter using the Unicode CLDR
This document describes CLDR::Number::Format::Percent v0.19, built with Unicode CLDR v29.
$perf = CLDR::Number::Format::Percent->new(locale => 'tr');
$cldr = CLDR::Number->new(locale => 'tr');
$perf = $cldr->percent_formatter;
# when locale is 'tr' (Turkish)
say $perf->format(0.05); # '%5'
# when locale is 'ar' (Arabic)
say $perf->format(0.05); # '٥٪'
# when locale is 'fr' (French)
say $perf->format(0.05); # '5 %'
$perf->permil(1); # per mil
say $perf->format(0.05); # '50 ‰'
Using the locale method as a setter is deprecated. In the future the object’s locale will become immutable. Please see issue #38 for details and to submit comments or concerns.
Localized percent formatter using the Unicode Common Locale Data Repository (CLDR).
Accepts a number and returns a formatted percent as a character string, localized for the current locale. If the permil attribute is true, formats as per mil instead of percent.
The common attributes locale, default_locale, numbering_system, decimal_sign, group_sign, plus_sign, minus_sign, and cldr_version are described under common attributes in CLDR::Number. All attributes described here other than permil have defaults that change depending on the current locale. All string attributes are expected to be character strings, not byte strings.
Default: false (0)
Examples: % (percent sign) for all locales
Examples: ‰ (per mille sign) for root and almost all locales
Examples: #,##0% for root, en; #,##0 % for de, fr; #,##,##0% for hi, bn, en-IN, and other locales of the Indian subcontinent
Examples: 1 for all locales
Examples: 0 for all locales
Examples: 3 for root and almost all locales
Not used when value is 0.
Examples: 0 for root, en, and most locales; 2 for hi, bn, en-IN, and other locales of the Indian subcontinent
Examples: 1 for root, en, and most locales; 2 for es (excluding es-419), pt-PT, pl, and several others; 3 for lv and my
0 and 1 are treated the same.
Nova Patch <firstname.lastname@example.org>
This project is brought to you by Shutterstock. Additional open source projects from Shutterstock can be found at code.shutterstock.com.
© 2013–2016 Shutterstock, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CLDR::Number, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.