# `NumberF.I18n`
[🔗](https://github.com/jamesnjovu/elixir_number_functions/blob/v0.3.0/lib/number_f/i18n.ex#L1)

Functions for number internationalization and localization.

# `format_currency`

Formats a number as currency according to locale-specific settings.

## Parameters
  - `number`: The number to format
  - `locale`: The locale code (e.g., "en-US", "fr-FR")
  - `options`: Additional formatting options
    - `:precision`: Number of decimal places (default: 2)
    - `:currency_code`: ISO currency code to override the locale default
    - `:symbol`: Whether to include the currency symbol (default: true)

## Examples

    iex> NumberF.I18n.format_currency(1234.56, "en-US")
    "$1,234.56"

    iex> NumberF.I18n.format_currency(1234.56, "fr-FR")
    "1 234,56 €"

    iex> NumberF.I18n.format_currency(1234.56, "en-US", currency_code: "EUR")
    "€1,234.56"

# `format_number`

Formats a number according to locale-specific settings.

## Parameters
  - `number`: The number to format
  - `locale`: The locale code (e.g., "en-US", "fr-FR")
  - `options`: Additional formatting options
    - `:precision`: Number of decimal places (default: 2)

## Examples

    iex> NumberF.I18n.format_number(1234567.89, "en-US")
    "1,234,567.89"

    iex> NumberF.I18n.format_number(1234567.89, "fr-FR")
    "1 234 567,89"

    iex> NumberF.I18n.format_number(1234567.89, "de-DE", precision: 3)
    "1.234.567,890"

# `get_currency_names`

Returns currency names for different languages.

## Parameters
  - `currency_code`: ISO currency code
  - `language`: Language code

## Examples

    iex> NumberF.I18n.get_currency_names("USD", "en")
    %{main: "dollars", sub: "cents"}

    iex> NumberF.I18n.get_currency_names("EUR", "fr")
    %{main: "euros", sub: "centimes"}

# `get_locale_settings`

Returns locale-specific number formatting settings.

## Parameters
  - `locale`: The locale code (e.g., "en-US", "fr-FR")

## Examples

    iex> NumberF.I18n.get_locale_settings("en-US")
    %{
      thousands_separator: ",",
      decimal_separator: ".",
      currency_symbol: "$",
      currency_symbol_first: true
    }

    iex> NumberF.I18n.get_locale_settings("fr-FR")
    %{
      thousands_separator: " ",
      decimal_separator: ",",
      currency_symbol: "€",
      currency_symbol_first: false
    }

# `parse_number`

Parses a localized number string into a floating-point value.

## Parameters
  - `number_string`: The string to parse
  - `locale`: The locale code (e.g., "en-US", "fr-FR")

## Examples

    iex> NumberF.I18n.parse_number("1,234.56", "en-US")
    1234.56

    iex> NumberF.I18n.parse_number("1 234,56", "fr-FR")
    1234.56

# `spell_number`

Spells out a number in the specified language.

## Parameters
  - `number`: The number to spell out
  - `language`: The language code (e.g., "en", "fr")
  - `options`: Additional options
    - `:capitalize`: Whether to capitalize the first letter (default: true)
    - `:currency`: Whether to add currency names (default: false)
    - `:currency_code`: ISO currency code (default: nil)

## Examples

    iex> NumberF.I18n.spell_number(42, "en")
    "Forty-two"

    iex> NumberF.I18n.spell_number(42, "fr")
    "Quarante-deux"

    iex> NumberF.I18n.spell_number(42.75, "en", currency: true, currency_code: "USD")
    "Forty-two dollars and seventy-five cents"

# `supported_languages`

Lists the languages `spell_number/3` can actually spell numbers in.

This is deliberately separate from `supported_locales/0`: the library formats
numbers for 22 locales but only spells them out in four languages. Passing an
unsupported language to `spell_number/3` used to return English silently, which
is far worse than an error — the caller had no way to notice.

## Examples

    iex> NumberF.I18n.supported_languages()
    ["de", "en", "es", "fr"]

---

*Consult [api-reference.md](api-reference.md) for complete listing*
