Ex_Cldr_Units v3.9.0 Release Notes

  • ๐Ÿš€ This is the changelog for Cldr_units v3.9.0 released on November 14th, 2021. For older changelogs please consult the release tag on GitHub

    ๐Ÿ› Bug Fixes

    • Use import Config not deprecated use Mix.Config in config files. Only significant for developers of ex_cldr_units.

    • ๐Ÿ‘‰ Make decimal a required dependency, not optional, since various pattern matches expect its presence.

    โœจ Enhancements

    • โž• Add support for currency-based units. This allows for calculations and formatting of units such as "$2 per gallon". For this example, the unit would be created with Cldr.Unit.new(2, "curr-usd-per-gallon"). The inverse is also possible, for example:
    iex> MyApp.Cldr.Unit.to_string(Cldr.Unit.new!(2, "curr-usd-per-gallon"))
    {:ok, "$2.00 per gallon"}
    iex> MyApp.Cldr.Unit.to_string(Cldr.Unit.new!(2, "gallon-per-curr-usd"))
    {:ok, "2 gallons per US dollar"}
    • โž• Add support for binary factor prefixed units. These units are factors of 1024 and include "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi" and "yobi". For example:
    iex> MyApp.Cldr.Unit.to_string Cldr.Unit.new!(3, :gibibyte)
    {:ok, "3 gibibytes"}
    • โž• Add support for integer prefixes for units. This is useful for units like "liters per 100 kilometers" or "25 calories per 100 grams". For example:
    iex> MyApp.Cldr.Unit.to_string Cldr.Unit.new!(25, "calorie_per_100-gram")
    {:ok, "25 calories per 100 grams"}