View Source Bonfire.Common.Localise.Cldr.Rbnf.NumberSystem (Bonfire v0.9.10-classic-beta.169)
Functions to implement the number system rule-based-number-format rules of CLDR.
These rules are defined only on the "und" locale and represent specialised number formatting.
The standard public API for RBNF is via the Cldr.Number.to_string/2
function.
The functions on this module are defined at compile time based upon the RBNF rules defined in the Unicode CLDR data repository. Available rules are identified by:
iex> Bonfire.Common.Localise.Cldr.Rbnf.NumberSystem.rule_sets(:und)
...> |> Enum.sort()
[
:armenian_lower,
:armenian_upper,
:cyrillic_lower,
:ethiopic,
:georgian,
:greek_lower,
:greek_upper,
:hebrew,
:hebrew_item,
:roman_lower,
:roman_upper,
:tamil,
:zz_default
]
A rule can then be invoked on an available rule_set. For example
iex> Bonfire.Common.Localise.Cldr.Rbnf.NumberSystem.roman_upper(123, :und)
"CXXIII"
This particular call is equivalent to the call through the public API of:
iex> Bonfire.Common.Localise.Cldr.Number.to_string(123, format: :roman)
{:ok, "CXXIII"}