Learn R Programming

i18n (version 0.2.0)

cldr_currencies: Get a single localized value from the currencies dataset

Description

The currencies table contains information of currency codes and localized display names and symbols across 574 locales. The cldr_currencies() function allows one to extract a single element value from the table by supplying the locale, the currency code (currency), and one of the following element names:

  • "currency_symbol"

  • "currency_symbol_narrow"

  • "currency_display_name"

  • "currency_display_name_count_1"

  • "currency_display_name_count_other"

Usage

cldr_currencies(
  locale = "en",
  currency = currency_code_list$USD,
  element = currencies_elements$currency_symbol
)

Value

A length one character vector.

Arguments

locale

The locale ID for which to obtain the data from the currencies table.

currency

The currency code (e.g., "USD", "EUR", etc.). A valid set of currency codes can be accessed through the currency_code_list object.

element

The element from which information will be obtained for the specified locale. A valid set of currency elements can be accessed through the currencies_elements list object.

Examples

If you would like to get the currency display name for the British Pound ("GBP") currency while in the "de" locale, the following invocation of cldr_currencies() can be used.

cldr_currencies(
  locale = "de",
  currency = currency_code_list$GBP,
  element = currencies_elements$currency_display_name
)

#> [1] "Britisches Pfund"