-
Notifications
You must be signed in to change notification settings - Fork 553
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
Locales #453
Changes from 1 commit
f4b9ad8
d150d93
330edb6
b4296af
3777c97
19f54ab
870a7cc
f27f6ce
44e4fb1
083575a
9b7fd23
61c17d7
0213867
1e6c086
6de9c1a
d10deae
1f9648f
26f3c77
a65a2b3
e4f16d7
f32e4f2
ee0853b
3f2659e
9085b05
eacc085
e6d601a
aef41e9
08be423
a63d0cf
12ca2c5
3c02970
72c960c
be0cdd3
048b144
1acab1d
2052de7
1f2fd4f
d786694
1a80aa0
3ef34a0
3d52936
e07be46
5986e3a
a417628
9cb89fa
5d1d9f1
119c413
790f9d5
87aa146
2d9c1dc
1dbb7fa
76fbfc2
ffbb600
dc66629
ab0c06a
c7a491b
16d29e4
ea3d20e
f6ecdcb
2cdb6d3
05358ae
d1ae67b
702c640
90b3e8e
b6c5395
6ebc477
6220e7f
bc96105
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Forked at: aaee912 Parent branch: chronotope/main
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,7 +10,7 @@ use core::ops::{Add, Sub}; | |||||||||||||||||||||||||
use core::{fmt, hash}; | ||||||||||||||||||||||||||
use oldtime::Duration as OldDuration; | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
#[cfg(all(feature = "locales", any(feature = "alloc", feature = "std", test)))] | ||||||||||||||||||||||||||
#[cfg(any(all(feature = "locales", any(feature = "alloc", feature = "std")), test))] | ||||||||||||||||||||||||||
use format::DelayedFormatLocalized; | ||||||||||||||||||||||||||
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. This should just be 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 copied DelayFormatLocalized from DelayFormat which has all of this. I just added the condition. Lines 683 to 694 in febb8dc
I can put it only on locales if you think it's correct (I'm really not sure) 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 believe this is really necessary as the feature locales won't work without alloc or std. If we reduce to only |
||||||||||||||||||||||||||
#[cfg(any(feature = "alloc", feature = "std", test))] | ||||||||||||||||||||||||||
use format::{DelayedFormat, Item, StrftimeItems}; | ||||||||||||||||||||||||||
|
@@ -299,7 +299,7 @@ where | |||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
/// Formats the date with the specified formatting items. | ||||||||||||||||||||||||||
#[cfg(all(feature = "locales", any(feature = "alloc", feature = "std", test)))] | ||||||||||||||||||||||||||
#[cfg(any(all(feature = "locales", any(feature = "alloc", feature = "std")), test))] | ||||||||||||||||||||||||||
#[inline] | ||||||||||||||||||||||||||
pub fn format_localized_with_items<'a, I, B>(&self, items: I) -> DelayedFormatLocalized<I> | ||||||||||||||||||||||||||
where | ||||||||||||||||||||||||||
|
@@ -312,7 +312,7 @@ where | |||||||||||||||||||||||||
/// Formats the date with the specified format string. | ||||||||||||||||||||||||||
/// See the [`format::strftime` module](./format/strftime/index.html) | ||||||||||||||||||||||||||
/// on the supported escape sequences. | ||||||||||||||||||||||||||
#[cfg(all(feature = "locales", any(feature = "alloc", feature = "std", test)))] | ||||||||||||||||||||||||||
#[cfg(any(all(feature = "locales", any(feature = "alloc", feature = "std")), test))] | ||||||||||||||||||||||||||
#[inline] | ||||||||||||||||||||||||||
pub fn format_localized<'a>(&self, fmt: &'a str) -> DelayedFormatLocalized<StrftimeItems<'a>> { | ||||||||||||||||||||||||||
self.format_localized_with_items(StrftimeItems::new(fmt)) | ||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ 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 { | ||
"POSIX" => Ok(pure_rust_locales::POSIX::$($item)::+), | ||
"en_US" => Ok(pure_rust_locales::en_US::$($item)::+), | ||
"fr_BE" => Ok(pure_rust_locales::fr_BE::$($item)::+), | ||
// TODO: all the locales are available | ||
|
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 don't think that this is necessary here, if chrono fails to build without the
locales
feature then that probably means that it's not correctly configured out (missing some#[cfg(locales)]
functionality).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.
yes sorry that was a leftover, fixed