CLDR-Number
view release on metacpan or search on metacpan
Revision history for Perl module CLDR::Number
0.19 2016-04-06
- Bugfix: require Class::Method::Modifiers because itâs a requirement of using
Moo::Role method modifiers but not a requirement of Moo::Role itself
0.18 2016-03-17
[ New CLDR version ]
- Upgrade CLDR data from v28 (2015-09-17) to v29 (2016-03-16)
- Release notes: http://cldr.unicode.org/index/downloads/cldr-29
[ New languages ]
- yue (Cantonese)
[ New locales for existing languages ]
- es-BR (Spanish in Brazil)
- pt-CH (Portuguese in Switzerland)
- pt-GQ (Portuguese in Equatorial Guinea)
- pt-LU (Portuguese in Luxembourg)
- 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]
0.13 2015-09-20
[ New CLDR version ]
- Upgrade CLDR data from v27.0.1 (2015-03-30) to v28 (2015-09-17)
- âAdded several English locales for Europe and W Asiaâ
- âMajor review of and improvement to Spanish locales for Latin Americaâ
- See also: http://cldr.unicode.org/index/downloads/cldr-28
[ New languages ]
- ce (Chechen)
- ckb (Central Kurdish)
- cu (Church Slavic)
- lrc (Northern Luri)
- mzn (Mazanderani)
- tk (Turkmen)
[ New locales for existing languages ]
NOTES
The Unicode private-use characters U+F8F0 through U+F8F4 are used
internally and are therefore not supported in custom patterns and signs.
SEE ALSO
* CLDR::Number::FAQ
* CLDR::Number::TODO
* Unicode beyond just characters: Localization with the CLDR
<http://patch.codes/talks/localization-with-the-unicode-cldr/>
(video and slides)
* Perl Advent Calendar: CLDR TL;DR
<http://perladvent.org/2014/2014-12-23.html>
* UTS #35: Unicode LDML, Part 3: Numbers
<http://www.unicode.org/reports/tr35/tr35-numbers.html>
* CLDR Translation Guidelines: Number Patterns
<http://cldr.unicode.org/translation/number-patterns>
* CLDR Translation Guidelines: Number Symbols
<http://cldr.unicode.org/translation/number-symbols>
AUTHOR
Nova Patch <patch@cpan.org>
This project is brought to you by Shutterstock
<http://www.shutterstock.com/>. Additional open source projects from
Shutterstock can be found at code.shutterstock.com
<http://code.shutterstock.com/>.
COPYRIGHT AND LICENSE
lib/CLDR/Number.pm view on Meta::CPAN
=head1 SEE ALSO
=over
=item * L<CLDR::Number::FAQ>
=item * L<CLDR::Number::TODO>
=item * L<Unicode beyond just characters: Localization with the
CLDR|http://patch.codes/talks/localization-with-the-unicode-cldr/> (video and
slides)
=item * L<Perl Advent Calendar:
CLDR TL;DR|http://perladvent.org/2014/2014-12-23.html>
=item * L<UTS #35: Unicode LDML, Part 3:
Numbers|http://www.unicode.org/reports/tr35/tr35-numbers.html>
=item * L<CLDR Translation Guidelines: Number
Patterns|http://cldr.unicode.org/translation/number-patterns>
=item * L<CLDR Translation Guidelines: Number
Symbols|http://cldr.unicode.org/translation/number-symbols>
=back
=head1 AUTHOR
Nova Patch <patch@cpan.org>
This project is brought to you by L<Shutterstock|http://www.shutterstock.com/>.
Additional open source projects from Shutterstock can be found at
L<code.shutterstock.com|http://code.shutterstock.com/>.
lib/CLDR/Number/FAQ.pod view on Meta::CPAN
Setting a default currency is just as inaccurate as setting a default number. If
your application depends on a default currency, the C<currency_code> attribute
can be explicitly set.
âB<Note:> I<Currency values should B<never> be interchanged without a known
currency code. You never want the number 3.5 interpreted as $3.50 by one user
and â¬3.50 by another.> Locale data contains localization information for
currencies, not a currency value for a country. A currency amount logically
consists of a numeric value, plus an accompanying currency code (or
equivalent).â âL<Unicode Technical Standard
#35|http://www.unicode.org/reports/tr35/tr35-numbers.html#Currencies>
=item How do I format years?
Years are a type of date, and dates have very different formatting rules than
regular numbers. Resources for localized date/time formatting include
L<DateTime>, L<DateTime::Locale>, and L<UTS #35: Unicode LDML, Part 4:
Dates|http://unicode.org/reports/tr35/tr35-dates.html>.
=item Why is the format different than expected?
Users occasionally report incorrect formatting for several non-existent locales.
This is most often the result of specifying a locale composed of an unrecognized
combination of language and country, which will cause the formatting to default
to the base language. Two common examples of this are C<en-MX> (Mexican English)
and C<es-BR> (Brazilian Spanish), which would default to C<en> (English) and
C<es> (Spanish), respectively. However, if demand is shown for them, they may be
added to the CLDR, such as C<es-BR>, which was added to CLDR v29.
lib/CLDR/Number/Format/Currency.pm view on Meta::CPAN
=back
=head1 SEE ALSO
=over
=item * L<CLDR::Number>
=item * L<CLDR Translation Guidelines: Currency
Symbols|http://cldr.unicode.org/translation/currency-names>
=back
=head1 AUTHOR
Nova Patch <patch@cpan.org>
This project is brought to you by L<Shutterstock|http://www.shutterstock.com/>.
Additional open source projects from Shutterstock can be found at
L<code.shutterstock.com|http://code.shutterstock.com/>.
t/from-uts35.t view on Meta::CPAN
use warnings;
use open qw( :encoding(UTF-8) :std );
use Test::More tests => 62;
use CLDR::Number;
my $cldr = CLDR::Number->new;
my ($decf, $perf, $scif, $curf);
# Tests adapted from examples in:
# UTS #35: Unicode LDML, Part 1: Core
# http://www.unicode.org/reports/tr35/tr35.html
TODO: {
local $TODO = 'Unicode locale extensions not currently retained';
# 3.7 Unicode BCP 47 Extension Data
$cldr->locale('th-u-foo-bar-nu-thai-ca-buddhist');
is $cldr->locale, 'th-u-bar-foo-ca-buddhist-nu-thai', 'sort attributes & keywords';
};
# Tests adapted from examples in:
# UTS #35: Unicode LDML, Part 3: Numbers
# http://www.unicode.org/reports/tr35/tr35-numbers.html
# 2.3 Number Symbols
$decf = $cldr->decimal_formatter(locale => 'en');
$decf->pattern('#,###'); is $decf->format(100_000_000), '100,000,000', 'group by 3';
$decf->pattern('#,####'); is $decf->format(1_0000_0000), '1,0000,0000', 'group by 4';
$decf->pattern('#,##,###'); is $decf->format(12_34_56_789), '12,34,56,789', 'primary group by 3, secondary group by 2';
$decf->pattern('###,###,####'); is $decf->format(100_000_0000), '100,000,0000', 'primary group by 4, secondary group by 3';
$decf->pattern('#,##,###,####'); is $decf->format(100_000_0000), '100,000,0000', 'ignore tertiary group';
$decf->pattern('##,#,###,####'); is $decf->format(100_000_0000), '100,000,0000', 'ignore tertiary group';
$perf = $cldr->percent_formatter(locale => 'en', permil => 1);
( run in 0.584 second using v1.01-cache-2.11-cpan-88abd93f124 )