-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locales #453
Merged
Merged
Locales #453
Changes from 8 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
f4b9ad8
Initial commit
cecton d150d93
Implement locales for format functions
cecton 330edb6
WIP
cecton b4296af
WIP
cecton 3777c97
Merge commit 130253ef2b914d300c1a0c6cff36cd3a5d846767 (no conflict)
cecton 19f54ab
WIP
cecton 870a7cc
WIP
cecton f27f6ce
WIP
cecton 44e4fb1
WIP
cecton 083575a
WIP
cecton 9b7fd23
WIP
cecton 61c17d7
WIP
cecton 0213867
WIP
cecton 1e6c086
WIP
cecton 6de9c1a
WIP
cecton d10deae
WIP
cecton 1f9648f
WIP
cecton 26f3c77
WIP
cecton a65a2b3
WIP
cecton e4f16d7
WIP
cecton f32e4f2
WIP
cecton ee0853b
WIP
cecton 3f2659e
WIP
cecton 9085b05
WIP
cecton eacc085
WIP
cecton e6d601a
Update src/format/mod.rs
cecton aef41e9
Update src/format/mod.rs
cecton 08be423
Update src/format/mod.rs
cecton a63d0cf
Update src/format/mod.rs
cecton 12ca2c5
Update src/format/mod.rs
cecton 3c02970
WIP
cecton 72c960c
Update src/format/mod.rs
cecton be0cdd3
WIP
cecton 048b144
WIP
cecton 1acab1d
WIP
cecton 2052de7
WIP
cecton 1f2fd4f
WIP
cecton d786694
WIP
cecton 1a80aa0
WIP
cecton 3ef34a0
WIP
cecton 3d52936
WIP
cecton e07be46
WIP
cecton 5986e3a
WIP
cecton a417628
WIP
cecton 9cb89fa
WIP
cecton 5d1d9f1
WIP
cecton 119c413
WIP
cecton 790f9d5
Small clean-up
cecton 87aa146
WIP
cecton 2d9c1dc
Remove allow dead_code
cecton 1dbb7fa
Merge commit 41345f10a1592ab9cc538a5cc7d7cad983d6a67c (no conflict)
cecton 76fbfc2
Merge commit bfddc1e5fa9d40c1e9d9ab46fecb3bf7f39315e6 (conflicts)
cecton ffbb600
Merge branch 'locales' of github.com:cecton/chrono into locales
cecton dc66629
CLEANUP
cecton ab0c06a
WIP
cecton c7a491b
WIP
cecton 16d29e4
Merge commit 53e63c3709332647811f1c738d5ba4a13980d439 (no conflict)
cecton ea3d20e
Update doc
cecton f6ecdcb
Revert "Update doc"
cecton 2cdb6d3
Revert "WIP"
cecton 05358ae
CLEANUP
cecton d1ae67b
WIP
cecton 702c640
Merge commit 0579d2af083e3b73164fd799c424b0481c3823e7 (no conflict)
cecton 90b3e8e
doc
cecton b6c5395
Doc comments
cecton 6ebc477
Merge commit 38810a33bf4581adfc45a31156b77c3078cb04d7 (conflicts)
cecton 6220e7f
Merge commit 370a20cb7130f9df53c2c50b1f965b58ba279729 (no conflict)
cecton bc96105
Rename locales feature to "unstable-locales" to make it easier to change
quodlibetor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ Ben Boeckel <[email protected]> | |
Ben Eills <[email protected]> | ||
Brandon W Maister <[email protected]> | ||
Brandon W Maister <[email protected]> | ||
Cecile Tonglet <[email protected]> | ||
Colin Ray <[email protected]> | ||
Corey Farwell <[email protected]> | ||
Dan <[email protected]> | ||
|
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use super::{FormatError, FormatErrorKind, FormatResult}; | ||
|
||
macro_rules! locale_match { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be nice if this function lived in pure-rust-locales instead of here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
($locale:expr => $($item:ident)::+) => {{ | ||
match $locale { | ||
"en_US" => Ok(pure_rust_locales::en_US::$($item)::+), | ||
"fr_BE" => Ok(pure_rust_locales::fr_BE::$($item)::+), | ||
// TODO: all the locales are available | ||
_ => Err(FormatError(FormatErrorKind::UnknownLocale)), | ||
} | ||
}} | ||
} | ||
|
||
pub(crate) fn short_months(locale: &str) -> FormatResult<&[&'static str]> { | ||
locale_match!(locale => LC_TIME::ABMON) | ||
} | ||
|
||
pub(crate) fn long_months(locale: &str) -> FormatResult<&[&'static str]> { | ||
locale_match!(locale => LC_TIME::MON) | ||
} | ||
|
||
pub(crate) fn short_weekdays(locale: &str) -> FormatResult<&[&'static str]> { | ||
locale_match!(locale => LC_TIME::ABDAY) | ||
} | ||
|
||
pub(crate) fn long_weekdays(locale: &str) -> FormatResult<&[&'static str]> { | ||
locale_match!(locale => LC_TIME::DAY) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make this
locales = ["pure-rust-locales", "alloc"]
many feature gates will be more obvious.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know it is possible to do that, nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done