Cldr.Number.Transliterate.transliterate
transliterate, go back to Cldr.Number.Transliterate module for more information.
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".
sequenceis the string to be transliterated.localeis any known locale, defaulting toCldr.get_locale/0.number_systemis any known number system. If expressed as astringit is the actual name of a known number system. If epressed as anatomit is used as a key to look up a number system for the locale (the usual keys are:defaultand:nativebut :traditional and :finance are also part of the standard). SeeCldr.Number.System.number_systems_for/2for 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 Cldr.Number.System.number_systems_for/2. Also see
Cldr.Number.Symbol.number_symbols_for/2.
Examples
iex> Cldr.Number.Transliterate.transliterate("123556", "en", :default, TestBackend.Cldr)
"123556"
iex> Cldr.Number.Transliterate.transliterate("123,556.000", "fr", :default, TestBackend.Cldr)
"123 556,000"
iex> Cldr.Number.Transliterate.transliterate("123556", "th", :default, TestBackend.Cldr)
"123556"
iex> Cldr.Number.Transliterate.transliterate("123556", "th", "thai", TestBackend.Cldr)
"๑๒๓๕๕๖"
iex> Cldr.Number.Transliterate.transliterate("123556", "th", :native, TestBackend.Cldr)
"๑๒๓๕๕๖"
iex> Cldr.Number.Transliterate.transliterate("Some number is: 123556", "th", "thai", TestBackend.Cldr)
"Some number is: ๑๒๓๕๕๖"