forked from unicode-org/icu4x
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
90 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// This file is part of ICU4X. For terms of use, please see the file | ||
// called LICENSE at the top level of the ICU4X source tree | ||
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). | ||
|
||
use crate::calendar::CldrCalendar; | ||
use crate::error::DateTimeError as Error; | ||
use crate::fields; | ||
use crate::input; | ||
use crate::input::{DateTimeInput, LocalizedDateTimeInput}; | ||
use crate::pattern::runtime::Pattern; | ||
use crate::provider::calendar::months; | ||
use crate::provider::date_time::DateSymbols; | ||
use crate::provider::neo::*; | ||
use core::fmt; | ||
use icu_calendar::types::Era; | ||
use icu_decimal::FixedDecimalFormatter; | ||
use icu_provider::prelude::*; | ||
use icu_calendar::types::MonthCode; | ||
|
||
pub struct DateTimePatternInterpolator<C: CldrCalendar> { | ||
year_symbols: Option<DataPayload<C::YearSymbolsV1Marker>>, | ||
month_symbols: Option<DataPayload<C::MonthSymbolsV1Marker>>, | ||
weekday_symbols: Option<DataPayload<WeekdaySymbolsV1Marker>>, | ||
dayperiod_symbols: Option<DataPayload<DayPeriodSymbolsV1Marker>>, | ||
fixed_decimal_formatter: Option<FixedDecimalFormatter>, | ||
} | ||
|
||
struct ErasedDateTimePatternInterpolator { | ||
year_symbols: Option<DataPayload<ErasedYearSymbolsV1Marker>>, | ||
month_symbols: Option<DataPayload<ErasedMonthSymbolsV1Marker>>, | ||
weekday_symbols: Option<DataPayload<WeekdaySymbolsV1Marker>>, | ||
dayperiod_symbols: Option<DataPayload<DayPeriodSymbolsV1Marker>>, | ||
fixed_decimal_formatter: Option<FixedDecimalFormatter>, | ||
} | ||
|
||
impl<'data> DateSymbols<'data> for ErasedDateTimePatternInterpolator { | ||
fn get_symbol_for_month( | ||
&self, | ||
month: fields::Month, | ||
length: fields::FieldLength, | ||
code: MonthCode, | ||
) -> Result<(&str, bool), Error> { | ||
todo!() | ||
} | ||
|
||
fn get_symbol_for_weekday( | ||
&self, | ||
weekday: fields::Weekday, | ||
length: fields::FieldLength, | ||
day: input::IsoWeekday, | ||
) -> Result<&str, Error> { | ||
todo!() | ||
} | ||
|
||
fn get_symbol_for_era<'a>(&'a self, length: fields::FieldLength, era_code: &'a Era) -> &str { | ||
Check warning on line 55 in components/datetime/src/format/neo.rs GitHub Actions / Docs Preview
|
||
todo!() | ||
} | ||
} | ||
|
||
impl<C: CldrCalendar> DateTimePatternInterpolator<C> { | ||
pub fn format_pattern<T, W>( | ||
pattern: &Pattern, | ||
datetime: &impl LocalizedDateTimeInput<T>, | ||
writeable: &mut W, | ||
) -> Result<(), Error> | ||
where | ||
T: DateTimeInput, | ||
W: fmt::Write + ?Sized, | ||
{ | ||
unimplemented!() | ||
} | ||
} |
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,3 @@ | ||
// This file is part of ICU4X. For terms of use, please see the file | ||
// called LICENSE at the top level of the ICU4X source tree | ||
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). |