-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a typed Locale struct with associated constants for all known values, replacing the Strings used in the codebase. The Locale type has two methods of note: `english_name` and `native_name`. These values are taken from the Discord documentation: <https://discord.com/developers/docs/reference#locales> This PR is meant to show how the new raw value representation introduced in PR #2045 looks when "typing" a value. This was previously left to the user to know what localizations might exist and to ensure a typo isn't made. This `Locale` type is still functionally a string in all but name (literally, as it implements the same traits and derefs in the same way String does), but it contains methods and the known values registered by Twilight as "sugar" on top of it.
- Loading branch information
1 parent
44d259a
commit 0f8a886
Showing
32 changed files
with
649 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,7 @@ mod tests { | |
Sticker, | ||
}, | ||
id::Id, | ||
user::{PremiumType, User, UserFlags}, | ||
user::{Locale, PremiumType, User, UserFlags}, | ||
util::{image_hash::ImageHashParseError, ImageHash}, | ||
}; | ||
|
||
|
@@ -207,7 +207,7 @@ mod tests { | |
email: Some("[email protected]".to_owned()), | ||
flags: Some(UserFlags::PREMIUM_EARLY_SUPPORTER | UserFlags::VERIFIED_DEVELOPER), | ||
id: Id::new(1), | ||
locale: Some("en-us".to_owned()), | ||
locale: Some(Locale::ENGLISH_US), | ||
mfa_enabled: Some(true), | ||
name: "test".to_owned(), | ||
premium_type: Some(PremiumType::NITRO), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.