You're seeing just the function put_locale, go back to MyApp.Cldr module for more information.


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

Set the current locale to be used for Cldr functions that take an optional locale parameter for which a locale is not supplied.


See rfc5646 for the specification of a language tag and consult Cldr.Rfc5646.Parser for the specification as implemented that includes the CLDR extensions for "u" (locales) and "t" (transforms).


iex> MyApp.Cldr.put_locale("en")
   backend: MyApp.Cldr,
   canonical_locale_name: "en-Latn-US",
   cldr_locale_name: "en",
   language_subtags: [],
   extensions: %{},
   gettext_locale_name: "en",
   language: "en",
   locale: %{},
   private_use: [],
   rbnf_locale_name: "en",
   requested_locale_name: "en",
   script: "Latn",
   territory: :US,
   transform: %{},
   language_variant: nil

iex> MyApp.Cldr.put_locale("invalid-locale!")
{:error, {Cldr.LanguageTag.ParseError,
  "Expected a BCP47 language tag. Could not parse the remaining \"!\" starting at position 15"}}