Enum DiscordLocale

java.lang.Object
java.lang.Enum<DiscordLocale>
net.dv8tion.jda.api.interactions.DiscordLocale
All Implemented Interfaces:
Serializable, Comparable<DiscordLocale>

public enum DiscordLocale extends Enum<DiscordLocale>
Enum representing the locales that Discord supports.

Based off Discord's locale list

  • Enum Constant Details

  • Method Details

    • values

      public static DiscordLocale[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static DiscordLocale valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getLocale

      @Nonnull public String getLocale()
      The locale tag, could be parsed by Locale.forLanguageTag(String)
      Returns:
      The locale tag
    • getLanguageName

      @Nonnull public String getLanguageName()
      The language's human-readable name, in English.
      Returns:
      The English language name
    • getNativeName

      @Nonnull public String getNativeName()
      The language's human-readable name, translated to the current language.
      Returns:
      The native language name
    • from

      @Nonnull public static DiscordLocale from(@Nonnull String localeTag)
      Converts the provided locale tag (such as en-GB or fr) to the enum constant
      Parameters:
      localeTag - The locale tag
      Returns:
      The DiscordLocale constant or UNKNOWN
      Throws:
      IllegalArgumentException - If the locale tag is null
    • from

      @Nonnull public static DiscordLocale from(@Nonnull Locale locale)
      Converts the provided Locale to the enum constant
      Parameters:
      locale - The locale
      Returns:
      The DiscordLocale constant or UNKNOWN
      Throws:
      IllegalArgumentException - If the locale is null