Cldr v0.0.5 Cldr.Rbnf

Rules Base Number Formatting

During compilation we want to look up the configured locales and generate the functions needed for only those locales.

For any other recognized locale we need a way to either fallback to a known locale, or error exit (configurable)

Summary

Functions

Returns a map that merges all rules by the primary dimension of RuleGroup, within which rbnf rules are keyed by locale

Returns the rbnf rules for a locale or {:error, :rbnf_file_not_found}

Returns the list of locales that is the intersection of Cldr.known_locales/0 and Cldr.Rbnf.rbnf_locales/0

Returns a list of the locales for which there is an rbnf rule set

Functions

for_all_locales()
for_all_locales :: %{}

Returns a map that merges all rules by the primary dimension of RuleGroup, within which rbnf rules are keyed by locale.

This function is primarily intended to support compile-time generation of functions to process rbnf rules.

for_locale(locale)
for_locale(Locale.t) :: %{} | {:error, :rbnf_file_not_found}

Returns the rbnf rules for a locale or {:error, :rbnf_file_not_found}

  • locale is any locale returned by Rbnf.known_locales/0.

Note that for_locale/1 does not raise if the locale does not exist like the majority of Cldr. This is by design since the set of locales that have rbnf rules is substantially less than the set of locales supported by Cldr.

known_locales()

Returns the list of locales that is the intersection of Cldr.known_locales/0 and Cldr.Rbnf.rbnf_locales/0

This list is therefore the set of known locales for which there are rbnf rules defined.

rbnf_dir()
rbnf_dir :: String.t
rbnf_locales()
rbnf_locales :: [String.t] | []

Returns a list of the locales for which there is an rbnf rule set

Relies on the presence of downloaded CLDR data. This can be achieved by runnuing mix cldr.download. This function is usefully primarily to a Cldr library developer.