MyApp.Cldr.Territory.translate_language_tag
You're seeing just the function
translate_language_tag
, go back to MyApp.Cldr.Territory module for more information.
Link to this function
translate_language_tag(from_locale, options \\ [locale: MyApp.Cldr.get_locale(), style: :standard])
View SourceSpecs
translate_language_tag(Cldr.Territory.tag(), Cldr.Territory.options()) :: {:ok, binary()} | {:error, Cldr.Territory.error()}
Translate a LanguageTag.t into a localized string from one locale to another.
Returns {:ok, result}
if successful, otherwise {:error, reason}
.
options
are:locale
is any configured locale. SeeMyApp.Cldr.Territory.known_locale_names/0
. The default isCldr.get_locale/0
style
is one of those returned byMyApp.Cldr.Territory.available_styles/0
. The current styles are:short
,:standard
and:variant
. The default is:standard
Example
iex> MyApp.Cldr.Territory.translate_language_tag(Cldr.get_locale())
{:ok, "world"}
iex> MyApp.Cldr.Territory.translate_language_tag(Cldr.get_locale(), [locale: Cldr.Locale.new!("pt", TestBackend.Cldr)])
{:ok, "Mundo"}