06 Apr 2016 17:51:34 UTC
- Distribution: CLDR-Number
- Source (raw)
- Browse (raw)
- How to Contribute
- Clone git repository
- Issues (21)
- Testers (3626 / 3 / 0)
- KwaliteeBus factor: 0
- 94.94% Coverage
- License: perl_5
- Perl: v5.8.1
- Activity24 month
- Download (58.03KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
CLDR::Number::FAQ - FAQ for CLDR::Number
This document describes CLDR::Number v0.19, built with Unicode CLDR v29.
- What’s the status of this project?
CLDR::Number is a stable project used for over a year in production by Shutterstock on www.shutterstock.com for formatting numbers, percents, and prices in twenty languages, ten currencies, and myriad countries. It is also used by other projects on the CPAN.
- How do I set precision?
maximum_fraction_digitscan be used. If you always want a specific number of fraction digits, also known as precision, set both of these attributes to the same number.
- How do I remove cents?
When displaying whole monetary numbers, it is sometimes desired to leave off the fraction digits (e.g. cents) for marketing purposes. To do this, set the
0. Beware though that some currencies have a number of fraction digits other than two, so it is not safe to set
2for arbitrary currencies.
- How do I set a default currency?
CLDR::Number::Format::Currency does not provide a default currency for the
currency_codeattribute like we have for the
localeattribute nor does it provide a default_currency_code attribute like the
default_localeattribute. This is because a price without a known currency has no known value. Setting a default currency is just as inaccurate as setting a default number. If your application depends on a default currency, the
currency_codeattribute can be explicitly set.
“Note: Currency values should 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).” —Unicode Technical Standard #35
- 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 DateTime, DateTime::Locale, and UTS #35: Unicode LDML, Part 4: Dates.
- 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
en-MX(Mexican English) and
es-BR(Brazilian Spanish), which would default to
es(Spanish), respectively. However, if demand is shown for them, they may be added to the CLDR, such as
es-BR, which was added to CLDR v29.