Skip to content

Releases: elixir-cldr/cldr_numbers

Cldr Numbers version 2.1.1

03 Feb 02:18
Compare
Choose a tag to compare

Bug Fixes

  • Formats Decimal.new("-0") the same as Decimal.new("0") which is to say without the sign. Although the Decimal standard upon which the Decimal library is based allos for -0, formatting this as a string with the sign is not consistent with the output for integers and floats. Consistency is, in this case, considered to be the correct approach.

  • Fix documentation errors

Cldr Numbers version 2.1.0

01 Dec 03:47
Compare
Choose a tag to compare

Enhancements

  • Added Cldr.Number.to_at_least_string/3, Cldr.Number.to_at_most_string/3, Cldr.Number.to_range_string/3 and Cldr.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> TestBackend.Cldr.Number.to_at_least_string 1234
{:ok, "1,234+"}

iex> TestBackend.Cldr.Number.to_at_most_string 1234
{:ok, "≤1,234"}

iex> TestBackend.Cldr.Number.to_approx_string 1234
{:ok, "~1,234"}

iex> TestBackend.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 a Cldr.Number.Format.Options struct. A user-visible benefit is that if passing a Cldr.Number.Format.Options struct to Cldr.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. A Cldr.Number.Format.Options struct can be returned by called Cldr.Number.Format.Options.validate_options(backend, options).

Cldr Numbers version 2.0.0

22 Nov 05:31
Compare
Choose a tag to compare

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 to MyApp.Cldr.Number.to_string/2 (assuming your configured backend module is called MyApp.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> TestBackend.Cldr.Number.to_string 2345, currency: :USD, format: "¤#,##0.00"
{:ok, "$2,345.00"}

iex> TestBackend.Cldr.Number.to_string 2345, currency: :USD, format: "¤¤#,##0.00"
{:ok, "USD 2,345.00"}

Cldr numbers version 2.0.0-rc.0

10 Nov 14:27
Compare
Choose a tag to compare
Pre-release

Changelog for Cldr_Numbers v2.0.0-rc.0

This is the changelog for Cldr v2.0.0-rc.0 released on October 18th, 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 to MyApp.Cldr.Number.to_string/2 (assuming your configured backend module is called MyApp.Cldr).

Cldr Numbers version 1.6.0

17 Oct 21:51
Compare
Choose a tag to compare

Enhancements

  • Updated dependency on ex_cldr to version 1.8 which uses CLDR version 34 data.

Cldr Numbers version 1.5.2

27 Sep 13:56
Compare
Choose a tag to compare

Bug Fixes

  • Correct the typespec for Cldr.Numbers.to_string/2. Thanks to @amuino. Closes Money #81.

  • Remove benchee as an optional dependent

Cldr Numbers version 1.5.1

19 Jul 22:26
Compare
Choose a tag to compare

Bug Fixes

  • Removes generated *.erl files from the package definition. This ensures that the correct version of erlang parse_tools is used when generating code from leex and yecc

Cldr Numbers version 1.5.0

08 Jul 13:12
Compare
Choose a tag to compare

Enhancements

  • Add the optional argument :minimum_grouping_digits to Number.to_string/2. For an understanding of the meaning of minimum grouping digits, consult this section of TR35. The use of this option should be considered exceptional - its use is to override the minimum grouping digits defined for a locale.

Cldr Numbers version 1.4.4.

30 May 11:17
Compare
Choose a tag to compare

Enhancements

  • Relaxes the requirement for ex_cldr

Cldr Numbers version 1.4.3

28 May 12:19
Compare
Choose a tag to compare

Enhancements

  • Extracts the data encapsultion for currencies to its own package ex_cldr_currencies. This package is a dependency here and optionally for the package ex_cldr_html.