CLDR-Number
view release on metacpan or search on metacpan
- Locales with value `2`: be (Belarusian), bg (Bulgarian), es (Spanish),
et (Estonian), ka (Georgian), pl (Polish), pt-PT (European Portuguese)
- Locales with value `3`: lv (Latvian), my (Burmese)
[ Examples ]
- en (1): 100 | 1,000 | 10,000 | 100,000 | 1,000,000
- pl (2): 100 | 1000 | 10Â 000 | 100Â 000 | 1Â 000Â 000
- my (3): ááá | áááá | ááááá | ááá,ááá | á,ááá,ááá
0.15 2015-09-22
- Bugfix: fix support for formatting `Inf` and `NaN` in Perl v5.22, which has
changed from the previous values `inf` and `nan` [#46]
0.14 2015-09-21
- Bugfix: fix formatting negative numbers along with a custom
rounding_increment value, which had caused double negative signs
- Bugfix: fix formatting of string values `inf` and `nan` which werenât treated
as numeric on combinations of some operating systems with some older versions
of Perl [#44, #45]
- Docs: typo fix by Fred Moyer @redhotpenguin++ [#43]
- osma (Osmanya Digits)
- shrd (Sharada Digits)
- sind (Khudawadi Digits)
- sinh (Sinhala Lith Digits)
- sora (Sora Sompeng Digits)
- takr (Takri Digits)
- tirh (Tirhuta Digits)
- wara (Warang Citi Digits)
0.12 2015-08-29
- Add support for passing infinity, negative infinity, and NaN arguments to all
formatting methods (format, at_least, range) on all formatting classes
(decimal, percent, currency), because those are valid numeric values in Perl,
which are now all localized even though it doesnât always make
sense [issue #26]
- Add `infinity` and `nan` attributes to all classes in addition to the decimal
formatter
0.11 2015-08-25
- Upgrade CLDR data from v24 (2013-09-18) to v27.0.1 (2015-03-30) [issue #33]
- Add bin/generate-cldr-data.pl script to update Perl data from CLDR JSON
plus_sign
Examples: "+" (plus sign) for root, en, and most locales
minus_sign
Examples: "-" (hyphen-minus) for root, en, and most locales
infinity
Examples: "â" (infinity) for root, en, and almost all locales
nan Examples: "NaN" for root, en, and most locales; many other
variations for individual locales like "не ÑиÑло" for ru and "鿏å¼"
for zh-Hant
cldr_version
Value: 29
This is a read-only attribute that will always reflect the currently
supported Unicode CLDR version.
NOTES
lib/CLDR/Number.pm view on Meta::CPAN
=item minus_sign
Examples: C<-> (hyphen-minus) for B<root>, B<en>, and most locales
=item infinity
Examples: C<â> (infinity) for B<root>, B<en>, and almost all locales
=item nan
Examples: C<NaN> for B<root>, B<en>, and most locales; many other variations for
individual locales like C<не ÑиÑло> for B<ru> and C<鿏å¼> for B<zh-Hant>
=item cldr_version
Value: C<29>
This is a read-only attribute that will always reflect the currently supported
Unicode CLDR version.
=back
lib/CLDR/Number/Data/Base.pm view on Meta::CPAN
currency => '¤ #,##0.00',
decimal => '#,##0.###',
percent => '#,##0%',
range => '{0}â{1}',
},
symbol => {
decimal => '.',
group => ',',
infinity => 'â',
minus => '-',
nan => 'NaN',
percent => '%',
permil => 'â°',
plus => '+',
},
attr => {
min_group => 1,
system => 'latn',
},
},
af => {
lib/CLDR/Number/Format/Decimal.pm view on Meta::CPAN
to submit comments or concerns.
=head1 DESCRIPTION
Localized decimal formatter using the Unicode Common Locale Data Repository
(CLDR).
=head2 Methods
Any argument that Perl can treat as a number is supported, including infinity,
negative infinity, and NaN, which are all localized appropriately. All methods
return character strings, not encoded byte strings.
=over
=item format
Accepts a number and returns a formatted decimal, localized for the current
locale.
=item at_least
t/inf-nan.t view on Meta::CPAN
my $inf = 9**9**9;
my $neg = -$inf;
my $nan = -sin($inf);
my $cldr = CLDR::Number->new(locale => 'en');
my $decf = $cldr->decimal_formatter;
my $perf = $cldr->percent_formatter;
my $curf = $cldr->currency_formatter(currency_code => 'EUR');
is $cldr->infinity, 'â', 'infinity attribute';
is $cldr->nan, 'NaN', 'nan attribute';
is $decf->format($inf), 'â', 'format infinity';
is $decf->format($neg), '-â', 'format negative infinity';
is $decf->format($nan), 'NaN', 'format NaN';
SKIP: {
skip 'infinity and NaN strings not supported on this system', 6
if 'inf' != $inf;
is $decf->format('inf'), 'â', 'format lowercase "inf" string';
is $decf->format('-inf'), '-â', 'format lowercase "-inf" string';
is $decf->format('nan'), 'NaN', 'format lowercase "nan" string';
is $decf->format('Inf'), 'â', 'format titlecase "Inf" string';
is $decf->format('-Inf'), '-â', 'format titlecase "-Inf" string';
is $decf->format('NaN'), 'NaN', 'format titlecase "NaN" string';
}
is $perf->format($inf), 'â%', 'format infinity percent';
is $perf->format($neg), '-â%', 'format negative infinity percent';
is $perf->format($nan), 'NaN%', 'format NaN percent';
is $curf->format($inf), 'â¬â', 'format infinity euros';
is $curf->format($neg), '-â¬â', 'format negative infinity euros';
is $curf->format($nan), 'â¬NaN', 'format NaN euros';
is $decf->at_least($inf), 'â+', 'format at least infinity';
is $decf->at_least($nan), 'NaN+', 'format at least NaN';
is $decf->range($neg, $inf), '-âââ', 'format range of infinity';
is $decf->range($nan, $nan), 'NaNâNaN', 'format range of NaN';
$cldr = CLDR::Number->new(locale => 'dz');
$decf = $cldr->decimal_formatter;
$perf = $cldr->percent_formatter;
$curf = $cldr->currency_formatter(currency_code => 'BTN');
is $cldr->infinity, 'à½à¾²à½à½¦à¼à½à½ºà½', 'infinity attribute (dz)';
is $cldr->nan, 'ཨà½à¼à½à½', 'nan attribute (dz)';
is $decf->format($inf), 'à½à¾²à½à½¦à¼à½à½ºà½', 'format infinity (dz)';
is $decf->format($neg), '-à½à¾²à½à½¦à¼à½à½ºà½', 'format negative infinity (dz)';
is $decf->format($nan), 'ཨà½à¼à½à½', 'format NaN (dz)';
is $perf->format($inf), 'à½à¾²à½à½¦à¼à½à½ºà½Â %', 'format infinity percent (dz)';
is $curf->format($inf), 'Nu.à½à¾²à½à½¦à¼à½à½ºà½', 'format infinity ngultrums (dz)';
( run in 0.299 second using v1.01-cache-2.11-cpan-4d50c553e7e )