#[non_exhaustive]pub enum Locale {
Show 33 variants
Indonesian,
Danish,
German,
EnglishUk,
EnglishUs,
Spanish,
SpanishLatam,
French,
Croatian,
Italian,
Lithuanian,
Hungarian,
Dutch,
Norwegian,
Polish,
PortugueseBrazilian,
Romanian,
Finnish,
Swedish,
Vietnamese,
Turkish,
Czech,
Greek,
Bulgarian,
Russian,
Ukrainian,
Hindi,
Thai,
ChineseChina,
Japanese,
ChineseTaiwan,
Korean,
Unknown(CompactString),
}Expand description
A locale: a language Discord’s client is available in.
Used for user and guild language settings and for localized command names and descriptions. Variant names follow the language names in the Discord docs.
discord.js counterpart: Locale.
§Examples
use djs_model::util::Locale;
let locale: Locale = serde_json::from_str(r#""pl""#).unwrap();
assert_eq!(locale, Locale::Polish);
assert_eq!(Locale::EnglishUs.as_str(), "en-US");
// Locales added by Discord later are kept as they are.
assert!(Locale::from("xx-YY").is_unknown());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Indonesian
Indonesian (Bahasa Indonesia).
Danish
Danish (Dansk).
German
German (Deutsch).
EnglishUk
English, United Kingdom.
EnglishUs
English, United States.
Spanish
Spanish, Spain (Español).
SpanishLatam
Spanish, Latin America (Español, LATAM).
French
French (Français).
Croatian
Croatian (Hrvatski).
Italian
Italian (Italiano).
Lithuanian
Lithuanian (Lietuviškai).
Hungarian
Hungarian (Magyar).
Dutch
Dutch (Nederlands).
Norwegian
Norwegian (Norsk).
Polish
Polish (Polski).
PortugueseBrazilian
Portuguese, Brazil (Português do Brasil).
Romanian
Romanian (Română).
Finnish
Finnish (Suomi).
Swedish
Swedish (Svenska).
Vietnamese
Vietnamese (Tiếng Việt).
Turkish
Turkish (Türkçe).
Czech
Czech (Čeština).
Greek
Greek (Ελληνικά).
Bulgarian
Bulgarian (български).
Russian
Russian (Pусский).
Ukrainian
Ukrainian (Українська).
Hindi
Hindi (हिन्दी).
Thai
Thai (ไทย).
ChineseChina
Chinese, China (中文).
Japanese
Japanese (日本語).
ChineseTaiwan
Chinese, Taiwan (繁體中文).
Korean
Korean (한국어).
Unknown(CompactString)
A value that this version of the library does not know about.
Discord may add new values at any time. They are preserved here so that no
information is lost and deserialization never fails because of them. Prefer
Locale::from over constructing this variant directly.
Implementations§
Source§impl Locale
impl Locale
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the string Discord uses for this value.
discord.js counterpart: the enum’s string value in discord-api-types.
Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true for a value this version of the library does not know about.
discord.js counterpart: none (discord.js passes unknown strings through).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Locale
impl<'de> Deserialize<'de> for Locale
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for Locale
Source§impl Ord for Locale
impl Ord for Locale
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Auto Trait Implementations§
impl Forget for Locale
impl Freeze for Locale
impl Move for Locale
impl RefUnwindSafe for Locale
impl Send for Locale
impl Sync for Locale
impl Unpin for Locale
impl UnsafeUnpin for Locale
impl UnwindSafe for Locale
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more