Changelog History
Page 7
-
v2.1.0 Changes
๐ This is the changelog for Cldr v2.1.0 released on December 1st, 2018. For older changelogs please consult the release tag on GitHub
โจ Enhancements
- Added
Cldr.Number.to_at_least_string/3
,Cldr.Number.to_at_most_string/3
,Cldr.Number.to_range_string/3
andCldr.Number.to_approx_string/3
to format numbers in way that conveys the relevant intent. These functions are also defined one each backend. For example, in the"en"
locale:
iex> MyApp.Cldr.Number.to_at_least_string 1234 {:ok, "1,234+"} iex> MyApp.Cldr.Number.to_at_most_string 1234 {:ok, "โค1,234"} iex> MyApp.Cldr.Number.to_approx_string 1234 {:ok, "~1,234"} iex> MyApp.Cldr.Number.to_range_string 1234..5678 {:ok, "1,234โ5,678"}
- ๐ Refactored options for
Cldr.Numbers.to_string/3
and other functions that use the common number formatting options structure. Options are now parsed and contained in aCldr.Number.Format.Options
struct. A user-visible benefit is that if passing aCldr.Number.Format.Options
struct toCldr.Number.to_string/3
then no further validation or normalization will be performed. Therefore if you are formatting in a tight loop and using common options, saving the options in advance will yield some performance improvement. ACldr.Number.Format.Options
struct can be returned by calledCldr.Number.Format.Options.validate_options(backend, options)
.
- Added
-
v2.0.0 Changes
๐ This is the changelog for Cldr v2.0.0 released on November 22nd, 2018. For older changelogs please consult the release tag on GitHub
๐ฅ Breaking Changes
ex_cldr_numbers
now depends upon ex_cldr version 2.0. As a result it is a requirement that at least one backend module be configured as described in the ex_cldr readme.The public API is now based upon functions defined on a backend module. Therefore calls to functions such as
Cldr.Number.to_string/2
should be replaced with calls toMyApp.Cldr.Number.to_string/2
(assuming your configured backend module is calledMyApp.Cldr
).
โจ Enhancements
Adds
Cldr.Number.validate_number_system/3
and<backend>.Number.validate_number_system/2
that are now the canonical way to validate and return a number system from either a number system binary or atom, or from a number system name.๐
Cldr.Number.{Ordinal, Cardinal}.pluralize/3
now support ranges, not just numbers๐ Currency spacing is now applied for currency formatting. Depending on the locale, some text may be placed between the current symbol and the number. This enhanced readibility, it does not change the number formatting itself. For example you can see below that for the locale "en", when the currency symbol is text, a non-breaking space is introduced between it and the number.
iex> MyApp.Cldr.Number.to_string 2345, currency: :USD, format: "ยค#,##0.00" {:ok, "$2,345.00"} iex> MyApp.Cldr.Number.to_string 2345, currency: :USD, format: "ยคยค#,##0.00" {:ok, "USDย 2,345.00"}