Nostrum.Locale (nostrum v0.11.0-dev)

View Source

Functions related to locales supported in localizations.

Currently, these are used in description and name localization within application commands.

Summary

Functions

Returns a list of all locales.

Returns true if term is a locale; otherwise returns false.

Converts the given locale atom to strings formatted for Discord API use.

Types

t()

(since NEXTVERSION)
@type t() ::
  :ko
  | :zh_tw
  | :ja
  | :zh_cn
  | :th
  | :hi
  | :uk
  | :ru
  | :bg
  | :el
  | :cs
  | :tr
  | :vi
  | :sv_se
  | :fi
  | :ro
  | :pt_br
  | :pl
  | :no
  | :nl
  | :hu
  | :lt
  | :it
  | :hr
  | :fr
  | :es_419
  | :es_es
  | :en_us
  | :en_gb
  | :de
  | :da
  | :id

Functions

all()

(since NEXTVERSION)
@spec all() :: [t()]

Returns a list of all locales.

is_locale(term)

(since NEXTVERSION) (macro)

Returns true if term is a locale; otherwise returns false.

Examples

iex> Nostrum.Locale.is_locale(:en_us)
true

iex> Nostrum.Locale.is_locale(:not_a_locale)
false

to_formatted_string(locale)

(since NEXTVERSION)
@spec to_formatted_string(t()) :: String.t()

Converts the given locale atom to strings formatted for Discord API use.

Examples

iex> Nostrum.Locale.to_formatted_string(:en_us)
"en-US"