Skip to content

Commit

Permalink
Add DiscordLocale#toLocale (#2485)
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 authored Aug 10, 2023
1 parent c0582c5 commit 77c626e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/net/dv8tion/jda/api/interactions/DiscordLocale.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@ public String getLocale()
return locale;
}

/**
* Creates a {@link Locale} from this DiscordLocale.
* <br>This is a simple shortcut to {@link Locale#forLanguageTag(String) Locale.forLanguageTag(getLocale())}.
*
* <p><b>Note:</b> The returned {@link Locale} might not be the same locale
* as the one passed in {@link #from(Locale) DiscordLocale#from(Locale)}.
* See {@link Locale#forLanguageTag(String)} for more details.
*
* @return the {@link Locale} from this DiscordLocale
*
* @see Locale#forLanguageTag(String)
*/
@Nonnull
public Locale toLocale()
{
return Locale.forLanguageTag(getLocale());
}

/**
* The language's human-readable name, in English.
*
Expand Down

0 comments on commit 77c626e

Please sign in to comment.