MyApp.Cldr.Number.Transliterate.transliterate

You're seeing just the function transliterate, go back to MyApp.Cldr.Number.Transliterate module for more information.
Link to this function

transliterate(sequence, locale \\ MyApp.Cldr.get_locale(), number_system \\ System.default_number_system_type())

View Source

Specs

transliterate(
  String.t(),
  Cldr.LanguageTag.t() | Cldr.Locale.locale_name(),
  String.t() | atom()
) :: String.t() | {:error, {module(), String.t()}}

Transliterates from latin digits to another number system's digits.

Transliterates the latin digits 0..9 to their equivalents in another number system. Also transliterates the decimal and grouping separators as well as the plus, minus and exponent symbols. Any other character in the string will be returned "as is".

Arguments

  • sequence is the string to be transliterated.

  • locale is any known locale, defaulting to MyApp.Cldr.get_locale/0.

  • number_system is any known number system. If expressed as a string it is the actual name of a known number system. If epressed as an atom it is used as a key to look up a number system for the locale (the usual keys are :default and :native but :traditional and :finance are also part of the standard). See MyApp.Cldr.Number.System.number_systems_for/1 for a locale to see what number system types are defined. The default is :default.

For available number systems see Cldr.Number.System.number_systems/0 and MyApp.Cldr.Number.System.number_systems_for/1. Also see MyApp.Cldr.Number.Symbol.number_symbols_for/1.

Examples

iex> MyApp.Cldr.Number.Transliterate.transliterate("123556")
"123556"

iex> MyApp.Cldr.Number.Transliterate.transliterate("123,556.000", "fr", :default)
"123 556,000"

iex> MyApp.Cldr.Number.Transliterate.transliterate("123556", "th", :default)
"123556"

iex> MyApp.Cldr.Number.Transliterate.transliterate("123556", "th", "thai")
"๑๒๓๕๕๖"

iex> MyApp.Cldr.Number.Transliterate.transliterate("123556", "th", :native)
"๑๒๓๕๕๖"

iex> MyApp.Cldr.Number.Transliterate.transliterate("Some number is: 123556", "th", "thai")
"Some number is: ๑๒๓๕๕๖"