Cldr v2.0.0 Cldr.Rbnf.Config View Source

Rules Base Number Formatting Configuration management.

During the process of consolidating the various CLDR files into a standard format that is easily digestible for Cldr, these functions are used to do the parsing and normalising of RBNF data.

Link to this section Summary

Functions

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 the directory where the RBNF data is stored

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

Link to this section Functions

Link to this function for_locale(locale_name) View Source
for_locale(Cldr.Locale.locale_name()) ::
  {:ok, map()} | {:error, {Cldr.Rbnf.NotAvailable, String.t()}}

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

  • locale_name 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.

Example

iex> {:ok, rules} = Cldr.Rbnf.Config.for_locale("en")
iex> Map.keys(rules)
[:OrdinalRules, :SpelloutRules]
Link to this function known_locale_names(backend) View Source

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.

Example

iex> Cldr.Rbnf.Config.known_locale_names
["lo", "eo", "ja", "el", "fo", "hu", "yue", "fil", "sq", "cy", "da", "sv", "ee",
 "et", "ta", "nl", "vi", "nb", "lv", "id", "pt-PT", "fa-AF", "lt", "my",
 "sr-Latn", "cs", "ms", "fa", "bg", "es", "en", "af", "mt", "am", "ca", "mk",
 "ro", "de-CH", "ka", "root", "hr", "nn", "hy", "pt", "se", "he", "ga", "sr",
 "hi", "ky", "ko", "zh-Hant", "kl", "km", "sk", "ru", "zh", "de", "fi", "it",
 "be", "pl", "az", "tr", "is", "fr-CH", "es-419", "th", "fr-BE", "fr", "sl",
 "bs", "uk", "ar"]

Returns the directory where the RBNF data is stored

Example

iex> Cldr.Rbnf.Config.rbnf_dir =~ "/cldr-rbnf/rbnf"
true
Link to this function rbnf_locale_names() View Source
rbnf_locale_names() :: [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 function is usefully primarily to a Cldr library developer.

Example

iex> Cldr.Rbnf.Config.rbnf_locales
["af", "am", "ar", "az", "be", "bg", "bs", "ca", "cs", "cy", "da", "de-CH",
 "de", "ee", "el", "en", "eo", "es-419", "es", "et", "fa-AF", "fa", "fi", "fil",
 "fo", "fr-BE", "fr-CH", "fr", "ga", "he", "hi", "hr", "hu", "hy", "id", "is",
 "it", "ja", "ka", "kl", "km", "ko", "ky", "lo", "lt", "lv", "mk", "ms", "mt",
 "my", "nb", "nl", "nn", "pl", "pt-PT", "pt", "ro", "root", "ru", "se", "sk",
 "sl", "sq", "sr-Latn", "sr", "sv", "ta", "th", "tr", "uk", "vi", "yue",
 "zh-Hant", "zh"]