Search documentation of bb

# BB.Cldr.Rbnf.Spellout (bb v0.8.0)

View Source

Functions to implement the spellout rule-based-number-format rules of CLDR.

As CLDR notes, the data is incomplete or non-existent for many languages. It is considered complete for English however.

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> BB.Cldr.Rbnf.Spellout.rule_sets("en")
    ...> |> Enum.sort()
    [
      :spellout_cardinal,
      :spellout_cardinal_verbose,
      :spellout_numbering,
      :spellout_numbering_verbose,
      :spellout_numbering_year,
      :spellout_ordinal,
      :spellout_ordinal_verbose
    ]

A rule can then be invoked on an available rule_set. For example:

    iex> BB.Cldr.Rbnf.Spellout.spellout_ordinal(123, "en")
    "one hundred twenty-third"

This call is equivalent to the call through the public API of:

    iex> BB.Cldr.Number.to_string(123, format: :spellout)
    {:ok, "one hundred twenty-three"}

# Summary

## Functions

all_rule_sets()
number and language_tag
and_o(number, language_tag)
commas(number, language_tag)
commas_o(number, language_tag)
r2d_year(number, language_tag)
rule_sets()
rule_sets(rbnf_locale_name)
spellout_cardinal(number, locale)
spellout_cardinal_verbose(number, locale)
spellout_numbering(number, locale)
spellout_numbering_verbose(number, locale)
spellout_numbering_year(number, locale)
spellout_ordinal(number, locale)
spellout_ordinal_verbose(number, locale)
th(number, language_tag)
tieth(number, language_tag)

# Functions

# all_rule_sets()

# number and language_tag

# and_o(number, language_tag)

# commas(number, language_tag)

# commas_o(number, language_tag)

# r2d_year(number, language_tag)

# rule_sets()

# rule_sets(rbnf_locale_name)

# spellout_cardinal(number, locale)

# spellout_cardinal_verbose(number, locale)

# spellout_numbering(number, locale)

# spellout_numbering_verbose(number, locale)

# spellout_numbering_year(number, locale)

# spellout_ordinal(number, locale)

# spellout_ordinal_verbose(number, locale)

# th(number, language_tag)

# tieth(number, language_tag)