1 #[cfg(feature = "unstable-locales")] 2 mod localized { 3 use pure_rust_locales::{locale_match, Locale}; 4 default_locale() -> Locale5 pub(crate) const fn default_locale() -> Locale { 6 Locale::POSIX 7 } 8 short_months(locale: Locale) -> &'static [&'static str]9 pub(crate) const fn short_months(locale: Locale) -> &'static [&'static str] { 10 locale_match!(locale => LC_TIME::ABMON) 11 } 12 long_months(locale: Locale) -> &'static [&'static str]13 pub(crate) const fn long_months(locale: Locale) -> &'static [&'static str] { 14 locale_match!(locale => LC_TIME::MON) 15 } 16 short_weekdays(locale: Locale) -> &'static [&'static str]17 pub(crate) const fn short_weekdays(locale: Locale) -> &'static [&'static str] { 18 locale_match!(locale => LC_TIME::ABDAY) 19 } 20 long_weekdays(locale: Locale) -> &'static [&'static str]21 pub(crate) const fn long_weekdays(locale: Locale) -> &'static [&'static str] { 22 locale_match!(locale => LC_TIME::DAY) 23 } 24 am_pm(locale: Locale) -> &'static [&'static str]25 pub(crate) const fn am_pm(locale: Locale) -> &'static [&'static str] { 26 locale_match!(locale => LC_TIME::AM_PM) 27 } 28 decimal_point(locale: Locale) -> &'static str29 pub(crate) const fn decimal_point(locale: Locale) -> &'static str { 30 locale_match!(locale => LC_NUMERIC::DECIMAL_POINT) 31 } 32 d_fmt(locale: Locale) -> &'static str33 pub(crate) const fn d_fmt(locale: Locale) -> &'static str { 34 locale_match!(locale => LC_TIME::D_FMT) 35 } 36 d_t_fmt(locale: Locale) -> &'static str37 pub(crate) const fn d_t_fmt(locale: Locale) -> &'static str { 38 locale_match!(locale => LC_TIME::D_T_FMT) 39 } 40 t_fmt(locale: Locale) -> &'static str41 pub(crate) const fn t_fmt(locale: Locale) -> &'static str { 42 locale_match!(locale => LC_TIME::T_FMT) 43 } 44 t_fmt_ampm(locale: Locale) -> &'static str45 pub(crate) const fn t_fmt_ampm(locale: Locale) -> &'static str { 46 locale_match!(locale => LC_TIME::T_FMT_AMPM) 47 } 48 } 49 50 #[cfg(feature = "unstable-locales")] 51 pub(crate) use localized::*; 52 #[cfg(feature = "unstable-locales")] 53 pub use pure_rust_locales::Locale; 54 55 #[cfg(not(feature = "unstable-locales"))] 56 mod unlocalized { 57 #[derive(Copy, Clone, Debug)] 58 pub(crate) struct Locale; 59 default_locale() -> Locale60 pub(crate) const fn default_locale() -> Locale { 61 Locale 62 } 63 short_months(_locale: Locale) -> &'static [&'static str]64 pub(crate) const fn short_months(_locale: Locale) -> &'static [&'static str] { 65 &["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] 66 } 67 long_months(_locale: Locale) -> &'static [&'static str]68 pub(crate) const fn long_months(_locale: Locale) -> &'static [&'static str] { 69 &[ 70 "January", 71 "February", 72 "March", 73 "April", 74 "May", 75 "June", 76 "July", 77 "August", 78 "September", 79 "October", 80 "November", 81 "December", 82 ] 83 } 84 short_weekdays(_locale: Locale) -> &'static [&'static str]85 pub(crate) const fn short_weekdays(_locale: Locale) -> &'static [&'static str] { 86 &["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] 87 } 88 long_weekdays(_locale: Locale) -> &'static [&'static str]89 pub(crate) const fn long_weekdays(_locale: Locale) -> &'static [&'static str] { 90 &["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] 91 } 92 am_pm(_locale: Locale) -> &'static [&'static str]93 pub(crate) const fn am_pm(_locale: Locale) -> &'static [&'static str] { 94 &["AM", "PM"] 95 } 96 decimal_point(_locale: Locale) -> &'static str97 pub(crate) const fn decimal_point(_locale: Locale) -> &'static str { 98 "." 99 } 100 } 101 102 #[cfg(not(feature = "unstable-locales"))] 103 pub(crate) use unlocalized::*; 104