View Source Bonfire.Common.Localise (Bonfire v0.9.10-classic-beta.169)
Various helpers for localisation
Summary
Functions
Gets the default locale from the configuration or returns "en".
Gets the current locale from the Cldr module.
Gets the current locale ID.
Gets the known locales from the Cldr module.
Converts a locale atom to its string representation.
Sets the given locale for both Cldr and Gettext.
Config for the Cldr.Plug.SetLocale
plug
Functions
Gets the default locale from the configuration or returns "en".
Examples
iex> default_locale()
"en"
Gets the current locale from the Cldr module.
Examples
iex> get_locale()
Bonfire.Common.Localise.Cldr.Locale.new!("en")
Gets the current locale ID.
Examples
iex> get_locale_id()
:en
Gets the known locales from the Cldr module.
Examples
> known_locales()
[:en, :es, :fr]
Converts a locale atom to its string representation.
Examples
iex> locale_name(:en)
"English"
iex> locale_name("fr")
"French"
Sets the given locale for both Cldr and Gettext.
Examples
iex> put_locale("es")
nil
Config for the Cldr.Plug.SetLocale
plug