From fe731834d86cf75f81f0a3642700dbb3525414f4 Mon Sep 17 00:00:00 2001 From: Zibi Braniecki Date: Mon, 21 Sep 2020 19:58:15 -0700 Subject: [PATCH 01/15] Add DateTimeFormat --- Cargo.toml | 1 + components/datetime/Cargo.toml | 33 ++ components/datetime/benches/datetime.rs | 156 ++++++++ components/datetime/benches/pattern.rs | 47 +++ components/datetime/src/date.rs | 32 ++ components/datetime/src/error.rs | 25 ++ components/datetime/src/fields.rs | 353 ++++++++++++++++++ components/datetime/src/format.rs | 79 ++++ components/datetime/src/lib.rs | 77 ++++ components/datetime/src/options/components.rs | 209 +++++++++++ components/datetime/src/options/mod.rs | 14 + components/datetime/src/options/style.rs | 48 +++ components/datetime/src/pattern.rs | 144 +++++++ components/datetime/src/provider.rs | 209 +++++++++++ components/datetime/tests/date.rs | 84 +++++ components/datetime/tests/pattern.rs | 31 ++ 16 files changed, 1542 insertions(+) create mode 100644 components/datetime/Cargo.toml create mode 100644 components/datetime/benches/datetime.rs create mode 100644 components/datetime/benches/pattern.rs create mode 100644 components/datetime/src/date.rs create mode 100644 components/datetime/src/error.rs create mode 100644 components/datetime/src/fields.rs create mode 100644 components/datetime/src/format.rs create mode 100644 components/datetime/src/lib.rs create mode 100644 components/datetime/src/options/components.rs create mode 100644 components/datetime/src/options/mod.rs create mode 100644 components/datetime/src/options/style.rs create mode 100644 components/datetime/src/pattern.rs create mode 100644 components/datetime/src/provider.rs create mode 100644 components/datetime/tests/date.rs create mode 100644 components/datetime/tests/pattern.rs diff --git a/Cargo.toml b/Cargo.toml index a0e61bda667..d57212c2215 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,4 +10,5 @@ members = [ "components/locale", "components/num-util", "components/pluralrules", + "components/datetime", ] diff --git a/components/datetime/Cargo.toml b/components/datetime/Cargo.toml new file mode 100644 index 00000000000..7d3f20f216d --- /dev/null +++ b/components/datetime/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "icu-datetime" +description = "API for managing Unicode Language and Locale Identifiers" +version = "0.0.1" +authors = ["The ICU4X Project Developers"] +edition = "2018" +readme = "README.md" +repository = "https://github.com/unicode-org/icu4x" +license-file = "../../LICENSE" +categories = ["internationalization"] +include = [ + "src/**/*", + "Cargo.toml", + "README.md" +] + +[dependencies] +icu-locale = { path = "../locale" } +icu-data-provider = { path = "../data-provider" } + +[dev-dependencies] +criterion = "0.3" +icu-data-provider = { path = "../data-provider", features = ["invariant"] } +icu-cldr-json-data-provider = { path = "../cldr-json-data-provider" } +icu-fs-data-provider = { path = "../fs-data-provider" } + +[[bench]] +name = "datetime" +harness = false + +[[bench]] +name = "pattern" +harness = false diff --git a/components/datetime/benches/datetime.rs b/components/datetime/benches/datetime.rs new file mode 100644 index 00000000000..ebcf7020a91 --- /dev/null +++ b/components/datetime/benches/datetime.rs @@ -0,0 +1,156 @@ +use criterion::{criterion_group, criterion_main, Criterion}; +use std::fmt::Write; + +use icu_datetime::date::DateTime; +use icu_datetime::options::{self, DateTimeFormatOptions}; +use icu_datetime::DateTimeFormat; +use icu_fs_data_provider::FsDataProvider; + +fn datetime_benches(c: &mut Criterion) { + let datetimes = vec![ + DateTime::new(2001, 9, 8, 18, 46, 40, 0), + DateTime::new(2017, 7, 13, 19, 40, 0, 0), + DateTime::new(2020, 9, 13, 5, 26, 40, 0), + DateTime::new(2021, 1, 6, 22, 13, 20, 0), + DateTime::new(2021, 5, 2, 17, 0, 0, 0), + DateTime::new(2021, 8, 26, 10, 46, 40, 0), + DateTime::new(2021, 12, 20, 3, 33, 20, 0), + DateTime::new(2022, 4, 14, 22, 20, 0, 0), + DateTime::new(2022, 8, 8, 16, 6, 40, 0), + DateTime::new(2033, 5, 17, 20, 33, 20, 0), + ]; + let values = &[ + ("pl", options::style::Date::Full, options::style::Time::None), + ("pl", options::style::Date::Long, options::style::Time::None), + ( + "pl", + options::style::Date::Medium, + options::style::Time::None, + ), + ( + "pl", + options::style::Date::Short, + options::style::Time::None, + ), + ("pl", options::style::Date::None, options::style::Time::Full), + ("pl", options::style::Date::None, options::style::Time::Long), + ( + "pl", + options::style::Date::None, + options::style::Time::Medium, + ), + ( + "pl", + options::style::Date::None, + options::style::Time::Short, + ), + ("pl", options::style::Date::Full, options::style::Time::Full), + ("pl", options::style::Date::Long, options::style::Time::Long), + ( + "pl", + options::style::Date::Medium, + options::style::Time::Medium, + ), + ( + "pl", + options::style::Date::Short, + options::style::Time::Short, + ), + ]; + + let mut results = vec![]; + + for _ in 0..datetimes.len() { + results.push(String::new()); + } + + let provider = FsDataProvider::try_new( + "/Users/zbraniecki/projects/intl-measurements/icu4x/data/icu4x/json", + ) + .expect("Loading file from testdata directory"); + + { + let mut group = c.benchmark_group("datetime"); + + group.bench_function("DateTimeFormat/format_to_write", |b| { + b.iter(|| { + for value in values { + let langid = value.0.parse().unwrap(); + let options = DateTimeFormatOptions::Style(options::style::Bag { + date: value.1, + time: value.2, + ..Default::default() + }); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + for (dt, result) in datetimes.iter().zip(results.iter_mut()) { + result.clear(); + let _ = dtf.format_to_write(&dt, result); + } + } + }) + }); + + group.bench_function("DateTimeFormat/format_to_string", |b| { + b.iter(|| { + for value in values { + let langid = value.0.parse().unwrap(); + let options = DateTimeFormatOptions::Style(options::style::Bag { + date: value.1, + time: value.2, + ..Default::default() + }); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + for dt in &datetimes { + let _ = dtf.format_to_string(&dt); + } + } + }) + }); + + group.bench_function("FormattedDateTime/format", |b| { + b.iter(|| { + for value in values { + let langid = value.0.parse().unwrap(); + let options = DateTimeFormatOptions::Style(options::style::Bag { + date: value.1, + time: value.2, + ..Default::default() + }); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + for (dt, result) in datetimes.iter().zip(results.iter_mut()) { + result.clear(); + let fdt = dtf.format(&dt); + write!(result, "{}", fdt).unwrap(); + } + } + }) + }); + + group.bench_function("FormattedDateTime/to_string", |b| { + b.iter(|| { + for value in values { + let langid = value.0.parse().unwrap(); + let options = DateTimeFormatOptions::Style(options::style::Bag { + date: value.1, + time: value.2, + ..Default::default() + }); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + for dt in &datetimes { + let fdt = dtf.format(&dt); + let _ = fdt.to_string(); + } + } + }) + }); + + group.finish(); + } +} + +criterion_group!(benches, datetime_benches,); +criterion_main!(benches); diff --git a/components/datetime/benches/pattern.rs b/components/datetime/benches/pattern.rs new file mode 100644 index 00000000000..b85b98a34ed --- /dev/null +++ b/components/datetime/benches/pattern.rs @@ -0,0 +1,47 @@ +use criterion::{criterion_group, criterion_main, Criterion}; + +use icu_datetime::pattern::Pattern; + +fn pattern_benches(c: &mut Criterion) { + let inputs = vec![ + "dd/MM/y", + "dd/MM", + "d MMM", + "d MMM y", + "MMMM y", + "d MMMM", + "HH:mm:ss", + "HH:mm", + "y", + "mm:ss", + "h:mm:ss B", + "E, h:mm B", + "E, h:mm:ss B", + "E d", + "E h:mm a", + "y G", + "MMM y G", + "dd/MM", + "E, dd/MM", + "LLL", + "E, d MMM y", + "E, dd/MM/y", + ]; + + { + let mut group = c.benchmark_group("pattern"); + + group.bench_function("parse", |b| { + b.iter(|| { + for input in &inputs { + let _ = Pattern::from_bytes(input.as_bytes()).unwrap(); + } + }) + }); + + group.finish(); + } +} + +criterion_group!(benches, pattern_benches,); +criterion_main!(benches); diff --git a/components/datetime/src/date.rs b/components/datetime/src/date.rs new file mode 100644 index 00000000000..0d9a635c481 --- /dev/null +++ b/components/datetime/src/date.rs @@ -0,0 +1,32 @@ +#[derive(Default)] +pub struct DateTime { + pub year: usize, + pub month: usize, + pub day: usize, + pub hour: usize, + pub minute: usize, + pub second: usize, + pub milliseconds: usize, +} + +impl DateTime { + pub fn new( + year: usize, + month: usize, + day: usize, + hour: usize, + minute: usize, + second: usize, + milliseconds: usize, + ) -> Self { + Self { + year, + month, + day, + hour, + minute, + second, + milliseconds, + } + } +} diff --git a/components/datetime/src/error.rs b/components/datetime/src/error.rs new file mode 100644 index 00000000000..af5237cb257 --- /dev/null +++ b/components/datetime/src/error.rs @@ -0,0 +1,25 @@ +use crate::pattern; +use icu_data_provider::prelude::DataError; + +/// A list of possible error outcomes for the [`DateTimeFormat`] struct. +/// +/// [`DateTimeFormat`]: ./struct.DateTimeFormat.html +#[derive(Debug)] +pub enum DateTimeFormatError { + Pattern(pattern::Error), + MissingData, + /// An error originating inside of the DataProvider + DataProvider(DataError), +} + +impl From for DateTimeFormatError { + fn from(err: DataError) -> Self { + Self::DataProvider(err) + } +} + +impl From for DateTimeFormatError { + fn from(err: pattern::Error) -> Self { + Self::Pattern(err) + } +} diff --git a/components/datetime/src/fields.rs b/components/datetime/src/fields.rs new file mode 100644 index 00000000000..54b436a5e58 --- /dev/null +++ b/components/datetime/src/fields.rs @@ -0,0 +1,353 @@ +use std::fmt; + +#[derive(Debug)] +pub enum Error { + Unknown, + TooLong, +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum FieldLength { + One = 1, + TwoDigit = 2, + Abbreviated = 3, + Wide = 4, + Narrow = 5, + Six = 6, +} + +impl FieldLength { + pub fn try_from(idx: usize) -> Result { + Ok(match idx { + 1 => Self::One, + 2 => Self::TwoDigit, + 3 => Self::Abbreviated, + 4 => Self::Wide, + 5 => Self::Narrow, + 6 => Self::Six, + _ => return Err(Error::TooLong), + }) + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum FieldSymbol { + Era, + Year(Year), + Month(Month), + Day(Day), + Weekday(Weekday), + Period(Period), + Hour(Hour), + Minute, + Second(Second), +} + +impl FieldSymbol { + pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { + match self { + Self::Era => w.write_char('G'), + Self::Year(year) => year.write(w), + Self::Month(month) => month.write(w), + Self::Day(day) => day.write(w), + Self::Weekday(weekday) => weekday.write(w), + Self::Period(period) => period.write(w), + Self::Hour(hour) => hour.write(w), + Self::Minute => w.write_char('m'), + Self::Second(second) => second.write(w), + } + } + + pub fn from_byte(b: u8) -> Result { + match b { + b'G' => Ok(Self::Era), + b'm' => Ok(Self::Minute), + _ => Year::from_byte(b) + .map(Self::Year) + .or_else(|_| Month::from_byte(b).map(Self::Month)) + .or_else(|_| Day::from_byte(b).map(Self::Day)) + .or_else(|_| Weekday::from_byte(b).map(Self::Weekday)) + .or_else(|_| Period::from_byte(b).map(Self::Period)) + .or_else(|_| Hour::from_byte(b).map(Self::Hour)) + .or_else(|_| Second::from_byte(b).map(Self::Second)), + } + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum FieldType { + Era, + Year, + Month, + Day, + Hour, +} + +impl FieldType { + pub fn iter() -> impl Iterator { + [Self::Era, Self::Year, Self::Month, Self::Day].iter() + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum Year { + Calendar, + WeekOf, + Extended, + Cyclic, + RelatedGregorian, +} + +impl Year { + pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { + w.write_char(match self { + Self::Calendar => 'y', + Self::WeekOf => 'Y', + Self::Extended => 'u', + Self::Cyclic => 'U', + Self::RelatedGregorian => 'r', + }) + } + + pub fn from_byte(b: u8) -> Result { + match b { + b'y' => Ok(Self::Calendar), + b'Y' => Ok(Self::WeekOf), + _ => Err(Error::Unknown), + } + } +} + +impl From for FieldSymbol { + fn from(input: Year) -> Self { + FieldSymbol::Year(input) + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum Month { + Format, + StandAlone, +} + +impl Month { + pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { + w.write_char(match self { + Self::Format => 'M', + Self::StandAlone => 'L', + }) + } + + pub fn from_byte(b: u8) -> Result { + match b { + b'M' => Ok(Self::Format), + b'L' => Ok(Self::StandAlone), + _ => Err(Error::Unknown), + } + } +} + +impl From for FieldSymbol { + fn from(input: Month) -> Self { + FieldSymbol::Month(input) + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum Day { + DayOfMonth, + DayOfYear, + DayOfWeekInMonth, + ModifiedJulianDay, +} + +impl Day { + pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { + w.write_char(match self { + Self::DayOfMonth => 'd', + Self::DayOfYear => 'D', + Self::DayOfWeekInMonth => 'F', + Self::ModifiedJulianDay => 'g', + }) + } + + pub fn from_byte(b: u8) -> Result { + match b { + b'd' => Ok(Self::DayOfMonth), + b'D' => Ok(Self::DayOfYear), + b'F' => Ok(Self::DayOfWeekInMonth), + b'g' => Ok(Self::ModifiedJulianDay), + _ => Err(Error::Unknown), + } + } +} + +impl From for FieldSymbol { + fn from(input: Day) -> Self { + FieldSymbol::Day(input) + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum Hour { + H11, + H12, + H23, + H24, + Preferred, + PreferredNoDayPeriod, + PreferredFlexibleDayPeriod, +} + +impl Hour { + pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { + w.write_char(match self { + Self::H11 => 'K', + Self::H12 => 'h', + Self::H23 => 'H', + Self::H24 => 'k', + Self::Preferred => 'j', + Self::PreferredNoDayPeriod => 'J', + Self::PreferredFlexibleDayPeriod => 'C', + }) + } + + pub fn from_byte(b: u8) -> Result { + match b { + b'K' => Ok(Self::H11), + b'h' => Ok(Self::H12), + b'H' => Ok(Self::H23), + b'k' => Ok(Self::H24), + b'j' => Ok(Self::Preferred), + b'J' => Ok(Self::PreferredNoDayPeriod), + b'C' => Ok(Self::PreferredFlexibleDayPeriod), + _ => Err(Error::Unknown), + } + } +} + +impl From for FieldSymbol { + fn from(input: Hour) -> Self { + FieldSymbol::Hour(input) + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum Second { + Second, + FractionalSecond, + Millisecond, +} + +impl Second { + pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { + w.write_char(match self { + Self::Second => 's', + Self::FractionalSecond => 'S', + Self::Millisecond => 'A', + }) + } + + pub fn from_byte(b: u8) -> Result { + match b { + b's' => Ok(Self::Second), + b'S' => Ok(Self::FractionalSecond), + b'A' => Ok(Self::Millisecond), + _ => Err(Error::Unknown), + } + } +} + +impl From for FieldSymbol { + fn from(input: Second) -> Self { + FieldSymbol::Second(input) + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum Weekday { + Format, + Local, + StandAlone, +} + +impl Weekday { + pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { + w.write_char(match self { + Self::Format => 'E', + Self::Local => 'e', + Self::StandAlone => 'c', + }) + } + + pub fn from_byte(b: u8) -> Result { + match b { + b'E' => Ok(Self::Format), + b'e' => Ok(Self::Local), + b'c' => Ok(Self::StandAlone), + _ => Err(Error::Unknown), + } + } +} + +impl From for FieldSymbol { + fn from(input: Weekday) -> Self { + FieldSymbol::Weekday(input) + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub enum Period { + AmPm, + NoonMidnight, + Flexible, +} + +impl Period { + pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { + w.write_char(match self { + Self::AmPm => 'a', + Self::NoonMidnight => 'b', + Self::Flexible => 'B', + }) + } + + pub fn from_byte(b: u8) -> Result { + match b { + b'a' => Ok(Self::AmPm), + b'b' => Ok(Self::NoonMidnight), + b'B' => Ok(Self::Flexible), + _ => Err(Error::Unknown), + } + } +} + +impl From for FieldSymbol { + fn from(input: Period) -> Self { + FieldSymbol::Period(input) + } +} + +#[derive(Debug, PartialEq, Clone, Copy)] +pub struct Field { + pub symbol: FieldSymbol, + pub length: FieldLength, +} + +impl Field { + pub fn write_pattern(&self, w: &mut impl fmt::Write) -> fmt::Result { + for _ in 0..(self.length as u8) { + self.symbol.write(w)?; + } + Ok(()) + } +} + +impl From<(FieldSymbol, FieldLength)> for Field { + fn from(input: (FieldSymbol, FieldLength)) -> Self { + Field { + symbol: input.0, + length: input.1, + } + } +} diff --git a/components/datetime/src/format.rs b/components/datetime/src/format.rs new file mode 100644 index 00000000000..c436b6dc4b3 --- /dev/null +++ b/components/datetime/src/format.rs @@ -0,0 +1,79 @@ +use super::date::DateTime; +use crate::fields::{FieldLength, FieldSymbol}; +use crate::pattern::{Pattern, PatternItem}; +use crate::provider::DateTimeDates; +use icu_data_provider::structs; +use std::fmt; + +pub struct FormattedDateTime<'l> { + pub(crate) pattern: &'l Pattern, + pub(crate) data: &'l structs::dates::gregory::DatesV1, + pub(crate) date_time: &'l DateTime, +} + +impl<'l> fmt::Display for FormattedDateTime<'l> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write_pattern(self.pattern, &self.data, &self.date_time, f) + } +} +// Temporary formatting number with length. +fn format_number( + result: &mut impl fmt::Write, + num: usize, + length: &FieldLength, +) -> Result<(), std::fmt::Error> { + write!(result, "{:0>width$}", num, width = (*length as u8) as usize) +} + +// Temporary simplified function to get the day of the week +fn get_day_of_week(year: usize, month: usize, day: usize) -> usize { + let t = &[0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]; + let year = if month < 3 { year - 1 } else { year }; + (year + year / 4 - year / 100 + year / 400 + t[month - 1] + day) % 7 +} + +pub fn write_pattern( + pattern: &crate::pattern::Pattern, + data: &structs::dates::gregory::DatesV1, + date_time: &DateTime, + w: &mut impl fmt::Write, +) -> std::fmt::Result { + for item in pattern.0.iter() { + match item { + PatternItem::Field(field) => match field.symbol { + FieldSymbol::Year(..) => format_number(w, date_time.year, &field.length)?, + FieldSymbol::Month(month) => match field.length { + FieldLength::One | FieldLength::TwoDigit => { + format_number(w, date_time.month, &field.length)? + } + length => { + let symbol = data + .get_symbol_for_month(month, length, date_time.month - 1) + .unwrap() + .unwrap(); + w.write_str(symbol)? + } + }, + FieldSymbol::Weekday(weekday) => { + let dow = get_day_of_week(date_time.year, date_time.month, date_time.day); + let symbol = data + .get_symbol_for_weekday(weekday, field.length, dow) + .unwrap() + .unwrap(); + w.write_str(symbol)? + } + FieldSymbol::Day(..) => format_number(w, date_time.day, &field.length)?, + FieldSymbol::Hour(..) => format_number(w, date_time.hour, &field.length)?, + FieldSymbol::Minute => format_number(w, date_time.minute, &field.length)?, + FieldSymbol::Second(..) => format_number(w, date_time.second, &field.length)?, + FieldSymbol::Period(..) => { + let symbols = &data.symbols.day_periods.format.wide.am; + w.write_str(symbols)? + } + b => unimplemented!("{:#?}", b), + }, + PatternItem::Literal(l) => w.write_str(l)?, + } + } + Ok(()) +} diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs new file mode 100644 index 00000000000..c10b31ec8b5 --- /dev/null +++ b/components/datetime/src/lib.rs @@ -0,0 +1,77 @@ +pub mod date; +mod error; +pub mod fields; +mod format; +pub mod options; +pub mod pattern; +mod provider; + +use date::DateTime; +pub use error::DateTimeFormatError; +use format::write_pattern; +pub use format::FormattedDateTime; +use icu_data_provider::{icu_data_key, structs, DataEntry, DataProvider, DataRequest}; +use icu_locale::LanguageIdentifier; +use options::DateTimeFormatOptions; +use pattern::Pattern; +use provider::DateTimeDates; +use std::borrow::Cow; + +pub struct DateTimeFormat<'d> { + _langid: LanguageIdentifier, + pattern: Pattern, + data: Cow<'d, structs::dates::gregory::DatesV1>, +} + +impl<'d> DateTimeFormat<'d> { + pub fn try_new>( + langid: LanguageIdentifier, + data_provider: &D, + options: &DateTimeFormatOptions, + ) -> Result { + let data_key = icu_data_key!(dates: gregory@1); + let response = data_provider + .load(&DataRequest { + data_key, + data_entry: DataEntry { + variant: None, + langid: langid.clone(), + }, + }) + .unwrap(); + let data: Cow = response.take_payload()?; + + let pattern = data + .get_pattern_for_options(options)? + .ok_or(error::DateTimeFormatError::MissingData)?; + + Ok(Self { + _langid: langid, + pattern, + data, + }) + } + + pub fn format<'s>(&'s self, value: &'s DateTime) -> FormattedDateTime<'s> { + FormattedDateTime { + pattern: &self.pattern, + data: &self.data, + date_time: value, + } + } + + pub fn format_to_write( + &self, + value: &DateTime, + w: &mut impl std::fmt::Write, + ) -> std::fmt::Result { + write_pattern(&self.pattern, &self.data, value, w) + } + + pub fn format_to_string(&self, value: &DateTime) -> String { + let mut s = String::new(); + self.format_to_write(value, &mut s) + .expect("Failed to write to a String."); + s + } +} diff --git a/components/datetime/src/options/components.rs b/components/datetime/src/options/components.rs new file mode 100644 index 00000000000..f05abd30251 --- /dev/null +++ b/components/datetime/src/options/components.rs @@ -0,0 +1,209 @@ +use crate::fields::{self, Field, FieldLength, FieldSymbol, FieldType}; +use std::fmt; + +#[derive(Debug)] +pub struct Bag { + pub era: Text, + pub year: Numeric, + pub month: Month, + pub day: Numeric, + pub weekday: Text, + + pub hour: Numeric, + pub minute: Numeric, + pub second: Numeric, + pub hour_cycle: HourCycle, + + pub time_zone_name: TimeZoneName, +} + +impl Default for Bag { + fn default() -> Self { + Self { + era: Text::default(), + year: Numeric::Numeric, + month: Month::Long, + day: Numeric::Numeric, + weekday: Text::default(), + + hour: Numeric::Numeric, + minute: Numeric::Numeric, + second: Numeric::Numeric, + hour_cycle: HourCycle::default(), + + time_zone_name: TimeZoneName::default(), + } + } +} + +impl Bag { + pub fn write_skeleton(&self, w: &mut impl fmt::Write) -> fmt::Result { + for field in self.skeleton() { + field.write_pattern(w)?; + } + Ok(()) + } + + fn get(&self, ft: &FieldType) -> Option { + match ft { + FieldType::Era => self.era.get_field(FieldSymbol::Era), + FieldType::Year => self + .year + .get_field(FieldSymbol::Year(fields::Year::Calendar)), + FieldType::Month => self + .month + .get_field(FieldSymbol::Month(fields::Month::Format)), + FieldType::Day => self + .day + .get_field(FieldSymbol::Day(fields::Day::DayOfMonth)), + FieldType::Hour => self + .hour + .get_field(FieldSymbol::Hour(self.hour_cycle.field())), + } + } + + pub fn skeleton(&self) -> impl Iterator + '_ { + FieldType::iter().filter_map(move |field_type| self.get(field_type)) + } +} + +impl fmt::Display for Bag { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.write_skeleton(f) + } +} + +pub trait ComponentType { + fn get_length(&self) -> Option; + + fn get_field(&self, symbol: FieldSymbol) -> Option { + self.get_length().map(|length| Field { symbol, length }) + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum HourCycle { + H24, + H23, + H12, + H11, + None, +} + +impl Default for HourCycle { + fn default() -> Self { + Self::None + } +} + +impl HourCycle { + pub fn field(&self) -> fields::Hour { + match self { + Self::H11 => fields::Hour::H11, + Self::H12 => fields::Hour::H12, + Self::H23 => fields::Hour::H23, + Self::H24 => fields::Hour::H24, + Self::None => fields::Hour::Preferred, + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Numeric { + Numeric, + TwoDigit, + None, +} + +impl Default for Numeric { + fn default() -> Self { + Self::None + } +} + +impl ComponentType for Numeric { + fn get_length(&self) -> Option { + match self { + Self::Numeric => Some(FieldLength::One), + Self::TwoDigit => Some(FieldLength::TwoDigit), + Self::None => None, + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Text { + Long, + Short, + Narrow, + None, +} + +impl Default for Text { + fn default() -> Self { + Self::None + } +} + +impl ComponentType for Text { + fn get_length(&self) -> Option { + match self { + Self::Short => Some(FieldLength::Six), + Self::Long => Some(FieldLength::Wide), + Self::Narrow => Some(FieldLength::Narrow), + Self::None => None, + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Month { + Numeric, + TwoDigit, + Long, + Short, + Narrow, + None, +} + +impl Default for Month { + fn default() -> Self { + Self::None + } +} + +impl ComponentType for Month { + fn get_length(&self) -> Option { + match self { + Self::Numeric => Some(FieldLength::One), + Self::TwoDigit => Some(FieldLength::TwoDigit), + Self::Long => Some(FieldLength::Wide), + Self::Short => Some(FieldLength::Abbreviated), + Self::Narrow => Some(FieldLength::Narrow), + Self::None => None, + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum TimeZoneName { + Long, + Short, + None, +} + +impl Default for TimeZoneName { + fn default() -> Self { + Self::None + } +} + +impl ComponentType for TimeZoneName { + fn get_length(&self) -> Option { + match self { + Self::Short => Some(FieldLength::One), + Self::Long => Some(FieldLength::Wide), + Self::None => None, + } + } +} diff --git a/components/datetime/src/options/mod.rs b/components/datetime/src/options/mod.rs new file mode 100644 index 00000000000..2f8553a3be5 --- /dev/null +++ b/components/datetime/src/options/mod.rs @@ -0,0 +1,14 @@ +pub mod components; +pub mod style; + +#[derive(Debug)] +pub enum DateTimeFormatOptions { + Style(style::Bag), + Components(components::Bag), +} + +impl Default for DateTimeFormatOptions { + fn default() -> Self { + Self::Style(style::Bag::default()) + } +} diff --git a/components/datetime/src/options/style.rs b/components/datetime/src/options/style.rs new file mode 100644 index 00000000000..2608ffec923 --- /dev/null +++ b/components/datetime/src/options/style.rs @@ -0,0 +1,48 @@ +use super::components; + +#[derive(Debug)] +pub struct Bag { + pub date: Date, + pub time: Time, + pub hour_cycle: components::HourCycle, +} + +impl Default for Bag { + fn default() -> Self { + Self { + date: Date::Long, + time: Time::Long, + hour_cycle: components::HourCycle::default(), + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Date { + Full, + Long, + Medium, + Short, + None, +} + +impl Default for Date { + fn default() -> Self { + Self::None + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Time { + Full, + Long, + Medium, + Short, + None, +} + +impl Default for Time { + fn default() -> Self { + Self::None + } +} diff --git a/components/datetime/src/pattern.rs b/components/datetime/src/pattern.rs new file mode 100644 index 00000000000..e0ee95d98a2 --- /dev/null +++ b/components/datetime/src/pattern.rs @@ -0,0 +1,144 @@ +use crate::fields::{self, Field, FieldLength, FieldSymbol}; +use std::iter::FromIterator; +use std::str; + +#[derive(Debug, PartialEq, Clone)] +pub enum PatternItem { + Field(fields::Field), + Literal(String), +} + +impl From for PatternItem { + fn from(input: Field) -> Self { + Self::Field(input) + } +} + +impl From<(FieldSymbol, FieldLength)> for PatternItem { + fn from(input: (FieldSymbol, FieldLength)) -> Self { + Field { + symbol: input.0, + length: input.1, + } + .into() + } +} + +impl<'p> From<&str> for PatternItem { + fn from(input: &str) -> Self { + Self::Literal(input.into()) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub struct Pattern(pub Vec); + +#[derive(Debug)] +pub enum Error { + Unknown, + FieldTooLong, + UnknownSubstitution(u8), +} + +impl From for Error { + fn from(input: fields::Error) -> Self { + match input { + fields::Error::Unknown => Self::Unknown, + fields::Error::TooLong => Self::FieldTooLong, + } + } +} + +impl Pattern { + pub fn from_bytes(input: &[u8]) -> Result { + let mut result: Vec = Vec::with_capacity(input.len()); + let mut symbol: Option<(Option<(FieldSymbol, u8)>, usize)> = None; + + for (idx, byte) in input.iter().enumerate() { + if let Some((Some((s, ref b)), token_start_idx)) = symbol { + if b == byte { + continue; + } + let len = idx - token_start_idx; + let length = FieldLength::try_from(len)?; + result.push(Field { symbol: s, length }.into()); + } + if let Ok(symb) = FieldSymbol::from_byte(*byte) { + if let Some((None, token_start_idx)) = symbol { + result.push(PatternItem::Literal( + String::from_utf8_lossy(&input[token_start_idx..idx]).to_string(), + )); + } + symbol = Some((Some((symb, *byte)), idx)); + } else if let Some((None, _)) = symbol { + } else { + symbol = Some((None, idx)); + } + } + if let Some((s, token_start_idx)) = symbol { + if let Some((s, _)) = s { + let len = input.len() - token_start_idx; + let length = FieldLength::try_from(len)?; + result.push(Field { symbol: s, length }.into()); + } else if input.len() != token_start_idx { + result.push(PatternItem::Literal( + String::from_utf8_lossy(&input[token_start_idx..]).to_string(), + )); + } + } + + Ok(Self(result)) + } + + pub fn from_bytes_combination( + input: &[u8], + mut date: Pattern, + mut time: Pattern, + ) -> Result { + let mut result: Vec = Vec::with_capacity(date.0.len() + time.0.len() + 2); + let mut ptr = 0; + let mut token_start_idx = 0; + + while let Some(b) = input.get(ptr) { + if b == &b'{' { + if token_start_idx != ptr { + result.push(PatternItem::Literal( + String::from_utf8_lossy(&input[token_start_idx..ptr]).to_string(), + )); + } + match input.get(ptr + 1) { + Some(b'0') => { + result.append(&mut time.0); + } + Some(b'1') => { + result.append(&mut date.0); + } + Some(b) => { + return Err(Error::UnknownSubstitution(*b)); + } + None => { + return Err(Error::Unknown); + } + } + ptr += 3; + token_start_idx = ptr; + continue; + } + + ptr += 1; + } + if token_start_idx != input.len() { + result.push(PatternItem::Literal( + String::from_utf8_lossy(&input[token_start_idx..]).to_string(), + )); + } + Ok(Self(result)) + } +} + +impl FromIterator for Pattern { + fn from_iter>(iter: I) -> Self { + let items: Vec = iter.into_iter().collect(); + Self(items) + } +} diff --git a/components/datetime/src/provider.rs b/components/datetime/src/provider.rs new file mode 100644 index 00000000000..390c5627ba8 --- /dev/null +++ b/components/datetime/src/provider.rs @@ -0,0 +1,209 @@ +use crate::error::DateTimeFormatError; +use crate::fields; +use crate::options::{style, DateTimeFormatOptions}; +use crate::pattern::Pattern; +use icu_data_provider::structs; +use std::borrow::Cow; + +type Result = std::result::Result; + +pub trait DateTimeDates { + fn get_pattern_for_options(&self, options: &DateTimeFormatOptions) -> Result>; + fn get_pattern_for_style_bag(&self, style: &style::Bag) -> Result>; + fn get_pattern_for_date_style(&self, style: style::Date) -> Result>; + fn get_pattern_for_time_style(&self, style: style::Time) -> Result>; + fn get_pattern_for_date_time_style( + &self, + style: style::Date, + date: Pattern, + time: Pattern, + ) -> Result>; + fn get_symbol_for_month( + &self, + month: fields::Month, + length: fields::FieldLength, + num: usize, + ) -> Result>>; + fn get_symbol_for_weekday( + &self, + weekday: fields::Weekday, + length: fields::FieldLength, + day: usize, + ) -> Result>>; + fn get_symbol_for_day_period( + &self, + day_period: fields::Period, + length: fields::FieldLength, + hour: usize, + ) -> Result>>; +} + +impl DateTimeDates for structs::dates::gregory::DatesV1 { + fn get_pattern_for_options(&self, options: &DateTimeFormatOptions) -> Result> { + match options { + DateTimeFormatOptions::Style(bag) => self.get_pattern_for_style_bag(bag), + DateTimeFormatOptions::Components(_) => unimplemented!(), + } + } + + fn get_pattern_for_style_bag(&self, style: &style::Bag) -> Result> { + match (style.date, style.time) { + (style::Date::None, style::Time::None) => Ok(None), + (style::Date::None, time_style) => self.get_pattern_for_time_style(time_style), + (date_style, style::Time::None) => self.get_pattern_for_date_style(date_style), + (date_style, time_style) => { + let time = self.get_pattern_for_time_style(time_style)?.unwrap(); + let date = self.get_pattern_for_date_style(date_style)?.unwrap(); + + self.get_pattern_for_date_time_style(date_style, date, time) + } + } + } + + fn get_pattern_for_date_style(&self, style: style::Date) -> Result> { + let date = &self.patterns.date; + let s = match style { + style::Date::Full => &date.full, + style::Date::Long => &date.long, + style::Date::Medium => &date.medium, + style::Date::Short => &date.short, + style::Date::None => { + return Ok(None); + } + }; + Ok(Some(Pattern::from_bytes(s.as_bytes())?)) + } + + fn get_pattern_for_date_time_style( + &self, + style: style::Date, + date: Pattern, + time: Pattern, + ) -> Result> { + let date_time = &self.patterns.date_time; + let s = match style { + style::Date::Full => &date_time.full, + style::Date::Long => &date_time.long, + style::Date::Medium => &date_time.medium, + style::Date::Short => &date_time.short, + style::Date::None => { + return Ok(None); + } + }; + Ok(Some(Pattern::from_bytes_combination( + s.as_bytes(), + date, + time, + )?)) + } + + fn get_pattern_for_time_style(&self, style: style::Time) -> Result> { + let time = &self.patterns.time; + let s = match style { + style::Time::Full => &time.full, + style::Time::Long => &time.long, + style::Time::Medium => &time.medium, + style::Time::Short => &time.short, + style::Time::None => { + return Ok(None); + } + }; + Ok(Some(Pattern::from_bytes(s.as_bytes())?)) + } + + fn get_symbol_for_weekday( + &self, + weekday: fields::Weekday, + length: fields::FieldLength, + day: usize, + ) -> Result>> { + let widths = match weekday { + fields::Weekday::Format => &self.symbols.weekdays.format, + fields::Weekday::StandAlone => { + if let Some(ref widths) = self.symbols.weekdays.stand_alone { + let symbols = match length { + fields::FieldLength::Wide => widths.wide.as_ref(), + fields::FieldLength::Narrow => widths.narrow.as_ref(), + fields::FieldLength::Six => { + widths.short.as_ref().or(widths.abbreviated.as_ref()) + } + _ => widths.abbreviated.as_ref(), + }; + if let Some(symbols) = symbols { + return Ok(symbols.0.get(day)); + } else { + return self.get_symbol_for_weekday(fields::Weekday::Format, length, day); + } + } else { + return self.get_symbol_for_weekday(fields::Weekday::Format, length, day); + } + } + fields::Weekday::Local => unimplemented!(), + }; + let symbols = match length { + fields::FieldLength::Wide => &widths.wide, + fields::FieldLength::Narrow => &widths.narrow, + fields::FieldLength::Six => widths.short.as_ref().unwrap_or(&widths.abbreviated), + _ => &widths.abbreviated, + }; + Ok(symbols.0.get(day)) + } + + fn get_symbol_for_month( + &self, + month: fields::Month, + length: fields::FieldLength, + num: usize, + ) -> Result>> { + let widths = match month { + fields::Month::Format => &self.symbols.months.format, + fields::Month::StandAlone => { + if let Some(ref widths) = self.symbols.months.stand_alone { + let symbols = match length { + fields::FieldLength::Abbreviated => widths.abbreviated.as_ref(), + fields::FieldLength::Wide => widths.wide.as_ref(), + fields::FieldLength::Narrow => widths.narrow.as_ref(), + _ => unreachable!(), + }; + if let Some(symbols) = symbols { + return Ok(symbols.0.get(num)); + } else { + return self.get_symbol_for_month(fields::Month::Format, length, num); + } + } else { + return self.get_symbol_for_month(fields::Month::Format, length, num); + } + } + }; + let symbols = match length { + fields::FieldLength::Abbreviated => &widths.abbreviated, + fields::FieldLength::Wide => &widths.wide, + fields::FieldLength::Narrow => &widths.narrow, + _ => unreachable!(), + }; + Ok(symbols.0.get(num)) + } + + fn get_symbol_for_day_period( + &self, + day_period: fields::Period, + length: fields::FieldLength, + hour: usize, + ) -> Result>> { + let widths = match day_period { + fields::Period::AmPm => &self.symbols.day_periods.format, + _ => unimplemented!(), + }; + let symbols = match length { + fields::FieldLength::Abbreviated => &widths.abbreviated, + fields::FieldLength::Wide => &widths.wide, + fields::FieldLength::Narrow => &widths.narrow, + _ => unreachable!(), + }; + if hour < 12 { + Ok(Some(&symbols.am)) + } else { + Ok(Some(&symbols.pm)) + } + } +} diff --git a/components/datetime/tests/date.rs b/components/datetime/tests/date.rs new file mode 100644 index 00000000000..eb8b7a12588 --- /dev/null +++ b/components/datetime/tests/date.rs @@ -0,0 +1,84 @@ +use icu_cldr_json_data_provider::{CldrJsonDataProvider, CldrPaths}; +use icu_datetime::date::DateTime; +use icu_datetime::options; +use icu_datetime::DateTimeFormat; +use std::fmt::Write; + +#[test] +fn it_works() { + let langid = "en".parse().unwrap(); + + let dt = DateTime { + year: 2020, + month: 8, + day: 5, + ..Default::default() + }; + + let mut cldr_paths = CldrPaths::default(); + + cldr_paths.cldr_dates = + Ok("/Users/zbraniecki/projects/intl-measurements/icu4x/data/cldr/cldr-dates-modern".into()); + + let provider = CldrJsonDataProvider::new(&cldr_paths); + + let dtf = DateTimeFormat::try_new( + langid, + &provider, + &options::DateTimeFormatOptions::Style(options::style::Bag { + date: options::style::Date::Short, + time: options::style::Time::None, + ..Default::default() + }), + ) + .unwrap(); + + let num = dtf.format(&dt); + + let s = num.to_string(); + assert_eq!(s, "8/5/2020"); + + let mut s = String::new(); + write!(s, "{}", num).unwrap(); + assert_eq!(s, "8/5/2020"); + + let mut s = String::new(); + dtf.format_to_write(&dt, &mut s).unwrap(); + assert_eq!(s, "8/5/2020"); + + let s = dtf.format_to_string(&dt); + assert_eq!(s, "8/5/2020"); +} + +#[test] +fn display_names() { + let langid = "en".parse().unwrap(); + let dt = DateTime { + year: 2020, + month: 8, + day: 5, + ..Default::default() + }; + + let mut cldr_paths = CldrPaths::default(); + + cldr_paths.cldr_dates = + Ok("/Users/zbraniecki/projects/intl-measurements/icu4x/data/cldr/cldr-dates-modern".into()); + + let provider = CldrJsonDataProvider::new(&cldr_paths); + + let dtf = DateTimeFormat::try_new( + langid, + &provider, + &options::DateTimeFormatOptions::Style(options::style::Bag { + date: options::style::Date::Medium, + time: options::style::Time::Short, + ..Default::default() + }), + ) + .unwrap(); + + let s = dtf.format_to_string(&dt); + + assert_eq!(s, "Aug 5, 2020, 0:00 AM"); +} diff --git a/components/datetime/tests/pattern.rs b/components/datetime/tests/pattern.rs new file mode 100644 index 00000000000..3eb4f36d3f2 --- /dev/null +++ b/components/datetime/tests/pattern.rs @@ -0,0 +1,31 @@ +use icu_datetime::fields::{self, FieldLength, FieldSymbol}; +use icu_datetime::pattern::Pattern; + +#[test] +fn pattern_parse() { + assert_eq!( + Pattern::from_bytes(b"dd/MM/y").unwrap(), + vec![ + (fields::Day::DayOfMonth.into(), FieldLength::TwoDigit).into(), + "/".into(), + (fields::Month::Format.into(), FieldLength::TwoDigit).into(), + "/".into(), + (fields::Year::Calendar.into(), FieldLength::One).into(), + ] + .into_iter() + .collect() + ); + + assert_eq!( + Pattern::from_bytes(b"HH:mm:ss").unwrap(), + vec![ + (fields::Hour::H23.into(), FieldLength::TwoDigit).into(), + ":".into(), + (FieldSymbol::Minute, FieldLength::TwoDigit).into(), + ":".into(), + (fields::Second::Second.into(), FieldLength::TwoDigit).into(), + ] + .into_iter() + .collect() + ); +} From 0cc7cc8f64aa596e58c84f2711a5ae4350542d30 Mon Sep 17 00:00:00 2001 From: Zibi Braniecki Date: Fri, 25 Sep 2020 14:13:02 -0700 Subject: [PATCH 02/15] Add Preferences to Options and remove leftovers from Skeleton building --- components/datetime/src/fields.rs | 6 + components/datetime/src/options/components.rs | 123 +----------------- components/datetime/src/options/mod.rs | 1 + .../datetime/src/options/preferences.rs | 33 +++++ components/datetime/src/options/style.rs | 6 +- 5 files changed, 47 insertions(+), 122 deletions(-) create mode 100644 components/datetime/src/options/preferences.rs diff --git a/components/datetime/src/fields.rs b/components/datetime/src/fields.rs index 54b436a5e58..316ec7461be 100644 --- a/components/datetime/src/fields.rs +++ b/components/datetime/src/fields.rs @@ -226,6 +226,12 @@ impl Hour { } } +impl Default for Hour { + fn default() -> Self { + Self::Preferred + } +} + impl From for FieldSymbol { fn from(input: Hour) -> Self { FieldSymbol::Hour(input) diff --git a/components/datetime/src/options/components.rs b/components/datetime/src/options/components.rs index f05abd30251..32478a7820f 100644 --- a/components/datetime/src/options/components.rs +++ b/components/datetime/src/options/components.rs @@ -1,5 +1,4 @@ -use crate::fields::{self, Field, FieldLength, FieldSymbol, FieldType}; -use std::fmt; +use super::preferences; #[derive(Debug)] pub struct Bag { @@ -12,9 +11,10 @@ pub struct Bag { pub hour: Numeric, pub minute: Numeric, pub second: Numeric, - pub hour_cycle: HourCycle, pub time_zone_name: TimeZoneName, + + pub preferences: Option, } impl Default for Bag { @@ -29,81 +29,10 @@ impl Default for Bag { hour: Numeric::Numeric, minute: Numeric::Numeric, second: Numeric::Numeric, - hour_cycle: HourCycle::default(), time_zone_name: TimeZoneName::default(), - } - } -} - -impl Bag { - pub fn write_skeleton(&self, w: &mut impl fmt::Write) -> fmt::Result { - for field in self.skeleton() { - field.write_pattern(w)?; - } - Ok(()) - } - fn get(&self, ft: &FieldType) -> Option { - match ft { - FieldType::Era => self.era.get_field(FieldSymbol::Era), - FieldType::Year => self - .year - .get_field(FieldSymbol::Year(fields::Year::Calendar)), - FieldType::Month => self - .month - .get_field(FieldSymbol::Month(fields::Month::Format)), - FieldType::Day => self - .day - .get_field(FieldSymbol::Day(fields::Day::DayOfMonth)), - FieldType::Hour => self - .hour - .get_field(FieldSymbol::Hour(self.hour_cycle.field())), - } - } - - pub fn skeleton(&self) -> impl Iterator + '_ { - FieldType::iter().filter_map(move |field_type| self.get(field_type)) - } -} - -impl fmt::Display for Bag { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.write_skeleton(f) - } -} - -pub trait ComponentType { - fn get_length(&self) -> Option; - - fn get_field(&self, symbol: FieldSymbol) -> Option { - self.get_length().map(|length| Field { symbol, length }) - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum HourCycle { - H24, - H23, - H12, - H11, - None, -} - -impl Default for HourCycle { - fn default() -> Self { - Self::None - } -} - -impl HourCycle { - pub fn field(&self) -> fields::Hour { - match self { - Self::H11 => fields::Hour::H11, - Self::H12 => fields::Hour::H12, - Self::H23 => fields::Hour::H23, - Self::H24 => fields::Hour::H24, - Self::None => fields::Hour::Preferred, + preferences: None, } } } @@ -121,16 +50,6 @@ impl Default for Numeric { } } -impl ComponentType for Numeric { - fn get_length(&self) -> Option { - match self { - Self::Numeric => Some(FieldLength::One), - Self::TwoDigit => Some(FieldLength::TwoDigit), - Self::None => None, - } - } -} - #[derive(Debug, Clone, Copy, PartialEq)] pub enum Text { Long, @@ -145,17 +64,6 @@ impl Default for Text { } } -impl ComponentType for Text { - fn get_length(&self) -> Option { - match self { - Self::Short => Some(FieldLength::Six), - Self::Long => Some(FieldLength::Wide), - Self::Narrow => Some(FieldLength::Narrow), - Self::None => None, - } - } -} - #[derive(Debug, Clone, Copy, PartialEq)] pub enum Month { Numeric, @@ -172,19 +80,6 @@ impl Default for Month { } } -impl ComponentType for Month { - fn get_length(&self) -> Option { - match self { - Self::Numeric => Some(FieldLength::One), - Self::TwoDigit => Some(FieldLength::TwoDigit), - Self::Long => Some(FieldLength::Wide), - Self::Short => Some(FieldLength::Abbreviated), - Self::Narrow => Some(FieldLength::Narrow), - Self::None => None, - } - } -} - #[derive(Debug, Clone, Copy, PartialEq)] pub enum TimeZoneName { Long, @@ -197,13 +92,3 @@ impl Default for TimeZoneName { Self::None } } - -impl ComponentType for TimeZoneName { - fn get_length(&self) -> Option { - match self { - Self::Short => Some(FieldLength::One), - Self::Long => Some(FieldLength::Wide), - Self::None => None, - } - } -} diff --git a/components/datetime/src/options/mod.rs b/components/datetime/src/options/mod.rs index 2f8553a3be5..e9509f73559 100644 --- a/components/datetime/src/options/mod.rs +++ b/components/datetime/src/options/mod.rs @@ -1,5 +1,6 @@ pub mod components; pub mod style; +pub mod preferences; #[derive(Debug)] pub enum DateTimeFormatOptions { diff --git a/components/datetime/src/options/preferences.rs b/components/datetime/src/options/preferences.rs new file mode 100644 index 00000000000..b80945fa754 --- /dev/null +++ b/components/datetime/src/options/preferences.rs @@ -0,0 +1,33 @@ +use crate::fields; + +#[derive(Debug)] +pub struct Bag { + pub hour_cycle: HourCycle, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum HourCycle { + H24, + H23, + H12, + H11, + None, +} + +impl Default for HourCycle { + fn default() -> Self { + Self::None + } +} + +impl HourCycle { + pub fn field(&self) -> fields::Hour { + match self { + Self::H11 => fields::Hour::H11, + Self::H12 => fields::Hour::H12, + Self::H23 => fields::Hour::H23, + Self::H24 => fields::Hour::H24, + Self::None => fields::Hour::Preferred, + } + } +} diff --git a/components/datetime/src/options/style.rs b/components/datetime/src/options/style.rs index 2608ffec923..4a2679b99bb 100644 --- a/components/datetime/src/options/style.rs +++ b/components/datetime/src/options/style.rs @@ -1,10 +1,10 @@ -use super::components; +use super::preferences; #[derive(Debug)] pub struct Bag { pub date: Date, pub time: Time, - pub hour_cycle: components::HourCycle, + pub preferences: Option, } impl Default for Bag { @@ -12,7 +12,7 @@ impl Default for Bag { Self { date: Date::Long, time: Time::Long, - hour_cycle: components::HourCycle::default(), + preferences: None, } } } From 0a2d7e1932268d6e83cf7919342902496d73b436 Mon Sep 17 00:00:00 2001 From: Zibi Braniecki Date: Fri, 25 Sep 2020 17:31:44 -0700 Subject: [PATCH 03/15] Add fixtures and data driven tests --- components/datetime/Cargo.toml | 2 + components/datetime/benches/datetime.rs | 168 +- components/datetime/benches/fixtures/mod.rs | 66 + .../datetime/benches/fixtures/structs.rs | 44 + .../benches/fixtures/tests/patterns.json | 24 + .../benches/fixtures/tests/styles.json | 126 + components/datetime/benches/pattern.rs | 29 +- components/datetime/src/date.rs | 20 +- components/datetime/src/format.rs | 52 +- components/datetime/src/lib.rs | 6 +- components/datetime/src/options/mod.rs | 2 +- components/datetime/src/pattern.rs | 35 +- components/datetime/src/provider.rs | 4 +- components/datetime/tests/date.rs | 84 - components/datetime/tests/datetime.rs | 36 + .../cldr-dates-modern/main/en/ca-generic.json | 536 ++++ .../main/en/ca-gregorian.json | 549 ++++ .../cldr-dates-modern/main/en/dateFields.json | 676 +++++ .../main/en/timeZoneNames.json | 2359 +++++++++++++++++ .../cldr-dates-modern/main/pl/ca-generic.json | 532 ++++ .../main/pl/ca-gregorian.json | 571 ++++ .../cldr-dates-modern/main/pl/dateFields.json | 859 ++++++ .../main/pl/timeZoneNames.json | 2170 +++++++++++++++ .../data/icu4x/dates/gregory@1/en.json | 1 + .../data/icu4x/dates/gregory@1/pl.json | 1 + .../fixtures/data/icu4x/dates/manifest.json | 4 + .../tests/fixtures/data/icu4x/manifest.json | 4 + components/datetime/tests/fixtures/mod.rs | 55 + components/datetime/tests/fixtures/structs.rs | 45 + .../datetime/tests/fixtures/tests/styles.json | 107 + components/datetime/tests/pattern.rs | 31 - 31 files changed, 8920 insertions(+), 278 deletions(-) create mode 100644 components/datetime/benches/fixtures/mod.rs create mode 100644 components/datetime/benches/fixtures/structs.rs create mode 100644 components/datetime/benches/fixtures/tests/patterns.json create mode 100644 components/datetime/benches/fixtures/tests/styles.json delete mode 100644 components/datetime/tests/date.rs create mode 100644 components/datetime/tests/datetime.rs create mode 100755 components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/ca-generic.json create mode 100755 components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/ca-gregorian.json create mode 100755 components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/dateFields.json create mode 100755 components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/timeZoneNames.json create mode 100755 components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/ca-generic.json create mode 100755 components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/ca-gregorian.json create mode 100755 components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/dateFields.json create mode 100755 components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/timeZoneNames.json create mode 100644 components/datetime/tests/fixtures/data/icu4x/dates/gregory@1/en.json create mode 100644 components/datetime/tests/fixtures/data/icu4x/dates/gregory@1/pl.json create mode 100644 components/datetime/tests/fixtures/data/icu4x/dates/manifest.json create mode 100644 components/datetime/tests/fixtures/data/icu4x/manifest.json create mode 100644 components/datetime/tests/fixtures/mod.rs create mode 100644 components/datetime/tests/fixtures/structs.rs create mode 100644 components/datetime/tests/fixtures/tests/styles.json delete mode 100644 components/datetime/tests/pattern.rs diff --git a/components/datetime/Cargo.toml b/components/datetime/Cargo.toml index 7d3f20f216d..1176b17673c 100644 --- a/components/datetime/Cargo.toml +++ b/components/datetime/Cargo.toml @@ -23,6 +23,8 @@ criterion = "0.3" icu-data-provider = { path = "../data-provider", features = ["invariant"] } icu-cldr-json-data-provider = { path = "../cldr-json-data-provider" } icu-fs-data-provider = { path = "../fs-data-provider" } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" [[bench]] name = "datetime" diff --git a/components/datetime/benches/datetime.rs b/components/datetime/benches/datetime.rs index ebcf7020a91..b20be983955 100644 --- a/components/datetime/benches/datetime.rs +++ b/components/datetime/benches/datetime.rs @@ -1,91 +1,37 @@ +mod fixtures; + use criterion::{criterion_group, criterion_main, Criterion}; use std::fmt::Write; -use icu_datetime::date::DateTime; -use icu_datetime::options::{self, DateTimeFormatOptions}; use icu_datetime::DateTimeFormat; use icu_fs_data_provider::FsDataProvider; fn datetime_benches(c: &mut Criterion) { - let datetimes = vec![ - DateTime::new(2001, 9, 8, 18, 46, 40, 0), - DateTime::new(2017, 7, 13, 19, 40, 0, 0), - DateTime::new(2020, 9, 13, 5, 26, 40, 0), - DateTime::new(2021, 1, 6, 22, 13, 20, 0), - DateTime::new(2021, 5, 2, 17, 0, 0, 0), - DateTime::new(2021, 8, 26, 10, 46, 40, 0), - DateTime::new(2021, 12, 20, 3, 33, 20, 0), - DateTime::new(2022, 4, 14, 22, 20, 0, 0), - DateTime::new(2022, 8, 8, 16, 6, 40, 0), - DateTime::new(2033, 5, 17, 20, 33, 20, 0), - ]; - let values = &[ - ("pl", options::style::Date::Full, options::style::Time::None), - ("pl", options::style::Date::Long, options::style::Time::None), - ( - "pl", - options::style::Date::Medium, - options::style::Time::None, - ), - ( - "pl", - options::style::Date::Short, - options::style::Time::None, - ), - ("pl", options::style::Date::None, options::style::Time::Full), - ("pl", options::style::Date::None, options::style::Time::Long), - ( - "pl", - options::style::Date::None, - options::style::Time::Medium, - ), - ( - "pl", - options::style::Date::None, - options::style::Time::Short, - ), - ("pl", options::style::Date::Full, options::style::Time::Full), - ("pl", options::style::Date::Long, options::style::Time::Long), - ( - "pl", - options::style::Date::Medium, - options::style::Time::Medium, - ), - ( - "pl", - options::style::Date::Short, - options::style::Time::Short, - ), - ]; - - let mut results = vec![]; - - for _ in 0..datetimes.len() { - results.push(String::new()); - } - let provider = FsDataProvider::try_new( - "/Users/zbraniecki/projects/intl-measurements/icu4x/data/icu4x/json", - ) - .expect("Loading file from testdata directory"); + let fxs = fixtures::get_fixture("styles").unwrap(); + + let provider = FsDataProvider::try_new("./tests/fixtures/data/icu4x") + .expect("Loading file from testdata directory"); { let mut group = c.benchmark_group("datetime"); group.bench_function("DateTimeFormat/format_to_write", |b| { b.iter(|| { - for value in values { - let langid = value.0.parse().unwrap(); - let options = DateTimeFormatOptions::Style(options::style::Bag { - date: value.1, - time: value.2, - ..Default::default() - }); - let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); - - for (dt, result) in datetimes.iter().zip(results.iter_mut()) { - result.clear(); - let _ = dtf.format_to_write(&dt, result); + for fx in &fxs.0 { + let datetimes: Vec<_> = fx.values.iter().map(|value| fixtures::parse_date(value).unwrap()).collect(); + + for setup in &fx.setups { + let langid = setup.locale.parse().unwrap(); + let options = fixtures::get_options(&setup.options); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + let mut result = String::new(); + + for dt in &datetimes { + let _ = dtf.format_to_write(&mut result, &dt); + result.clear(); + } } } }) @@ -93,17 +39,17 @@ fn datetime_benches(c: &mut Criterion) { group.bench_function("DateTimeFormat/format_to_string", |b| { b.iter(|| { - for value in values { - let langid = value.0.parse().unwrap(); - let options = DateTimeFormatOptions::Style(options::style::Bag { - date: value.1, - time: value.2, - ..Default::default() - }); - let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); - - for dt in &datetimes { - let _ = dtf.format_to_string(&dt); + for fx in &fxs.0 { + let datetimes: Vec<_> = fx.values.iter().map(|value| fixtures::parse_date(value).unwrap()).collect(); + + for setup in &fx.setups { + let langid = setup.locale.parse().unwrap(); + let options = fixtures::get_options(&setup.options); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + for dt in &datetimes { + let _ = dtf.format_to_string(&dt); + } } } }) @@ -111,19 +57,21 @@ fn datetime_benches(c: &mut Criterion) { group.bench_function("FormattedDateTime/format", |b| { b.iter(|| { - for value in values { - let langid = value.0.parse().unwrap(); - let options = DateTimeFormatOptions::Style(options::style::Bag { - date: value.1, - time: value.2, - ..Default::default() - }); - let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); - - for (dt, result) in datetimes.iter().zip(results.iter_mut()) { - result.clear(); - let fdt = dtf.format(&dt); - write!(result, "{}", fdt).unwrap(); + for fx in &fxs.0 { + let datetimes: Vec<_> = fx.values.iter().map(|value| fixtures::parse_date(value).unwrap()).collect(); + + for setup in &fx.setups { + let langid = setup.locale.parse().unwrap(); + let options = fixtures::get_options(&setup.options); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + let mut result = String::new(); + + for dt in &datetimes { + let fdt = dtf.format(&dt); + write!(result, "{}", fdt).unwrap(); + result.clear(); + } } } }) @@ -131,18 +79,18 @@ fn datetime_benches(c: &mut Criterion) { group.bench_function("FormattedDateTime/to_string", |b| { b.iter(|| { - for value in values { - let langid = value.0.parse().unwrap(); - let options = DateTimeFormatOptions::Style(options::style::Bag { - date: value.1, - time: value.2, - ..Default::default() - }); - let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); - - for dt in &datetimes { - let fdt = dtf.format(&dt); - let _ = fdt.to_string(); + for fx in &fxs.0 { + let datetimes: Vec<_> = fx.values.iter().map(|value| fixtures::parse_date(value).unwrap()).collect(); + + for setup in &fx.setups { + let langid = setup.locale.parse().unwrap(); + let options = fixtures::get_options(&setup.options); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + for dt in &datetimes { + let fdt = dtf.format(&dt); + let _ = fdt.to_string(); + } } } }) diff --git a/components/datetime/benches/fixtures/mod.rs b/components/datetime/benches/fixtures/mod.rs new file mode 100644 index 00000000000..e0b02ee0f43 --- /dev/null +++ b/components/datetime/benches/fixtures/mod.rs @@ -0,0 +1,66 @@ +pub mod structs; + +use icu_datetime::date::DateTime; +use icu_datetime::options; +use icu_datetime::DateTimeFormatOptions; +use serde_json; +use std::fs::File; +use std::io::BufReader; + +#[allow(dead_code)] +pub fn get_fixture(name: &str) -> std::io::Result { + let file = File::open(format!("./benches/fixtures/tests/{}.json", name))?; + let reader = BufReader::new(file); + + Ok(serde_json::from_reader(reader)?) +} + +#[allow(dead_code)] +pub fn get_patterns_fixture() -> std::io::Result { + let file = File::open("./benches/fixtures/tests/patterns.json")?; + let reader = BufReader::new(file); + + Ok(serde_json::from_reader(reader)?) +} + +#[allow(dead_code)] +pub fn get_options(input: &structs::TestOptions) -> DateTimeFormatOptions { + let style = options::style::Bag { + date: match input.style.date { + Some(structs::TestStyleWidth::Full) => options::style::Date::Full, + Some(structs::TestStyleWidth::Long) => options::style::Date::Long, + Some(structs::TestStyleWidth::Medium) => options::style::Date::Medium, + Some(structs::TestStyleWidth::Short) => options::style::Date::Short, + None => options::style::Date::None, + }, + time: match input.style.time { + Some(structs::TestStyleWidth::Full) => options::style::Time::Full, + Some(structs::TestStyleWidth::Long) => options::style::Time::Long, + Some(structs::TestStyleWidth::Medium) => options::style::Time::Medium, + Some(structs::TestStyleWidth::Short) => options::style::Time::Short, + None => options::style::Time::None, + }, + ..Default::default() + }; + DateTimeFormatOptions::Style(style) +} + +#[allow(dead_code)] +pub fn parse_date(input: &str) -> Result { + let year: usize = input[0..4].parse()?; + let month: usize = input[5..7].parse()?; + let day: usize = input[8..10].parse()?; + let hour: usize = input[11..13].parse()?; + let minute: usize = input[14..16].parse()?; + let second: usize = input[17..19].parse()?; + let millisecond: usize = input[20..23].parse()?; + Ok(DateTime { + year, + month: month - 1, + day: day - 1, + hour, + minute, + second, + millisecond, + }) +} diff --git a/components/datetime/benches/fixtures/structs.rs b/components/datetime/benches/fixtures/structs.rs new file mode 100644 index 00000000000..19655e55492 --- /dev/null +++ b/components/datetime/benches/fixtures/structs.rs @@ -0,0 +1,44 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct Fixture(pub Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct Test { + pub setups: Vec, + pub values: Vec, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct TestInput { + pub locale: String, + pub options: TestOptions, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct TestOptions { + pub style: TestOptionsStyle, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct TestOptionsStyle { + pub date: Option, + pub time: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub enum TestStyleWidth { + #[serde(rename = "short")] + Short, + #[serde(rename = "medium")] + Medium, + #[serde(rename = "long")] + Long, + #[serde(rename = "full")] + Full, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PatternsFixture( + pub Vec +); diff --git a/components/datetime/benches/fixtures/tests/patterns.json b/components/datetime/benches/fixtures/tests/patterns.json new file mode 100644 index 00000000000..0feb96af842 --- /dev/null +++ b/components/datetime/benches/fixtures/tests/patterns.json @@ -0,0 +1,24 @@ +[ + "dd/MM/y", + "dd/MM", + "d MMM", + "d MMM y", + "MMMM y", + "d MMMM", + "HH:mm:ss", + "HH:mm", + "y", + "mm:ss", + "h:mm:ss B", + "E, h:mm B", + "E, h:mm:ss B", + "E d", + "E h:mm a", + "y G", + "MMM y G", + "dd/MM", + "E, dd/MM", + "LLL", + "E, d MMM y", + "E, dd/MM/y" +] diff --git a/components/datetime/benches/fixtures/tests/styles.json b/components/datetime/benches/fixtures/tests/styles.json new file mode 100644 index 00000000000..e780b0dc2c0 --- /dev/null +++ b/components/datetime/benches/fixtures/tests/styles.json @@ -0,0 +1,126 @@ +[ + { + "setups": [ + { + "locale": "pl", + "options": { + "style": { + "date": "full", + "time": null + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": "long", + "time": null + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": "medium", + "time": null + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": "short", + "time": null + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": null, + "time": "full" + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": null, + "time": "long" + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": null, + "time": "medium" + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": null, + "time": "short" + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": "full", + "time": "full" + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": "long", + "time": "long" + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": "medium", + "time": "medium" + } + } + }, + { + "locale": "pl", + "options": { + "style": { + "date": "short", + "time": "short" + } + } + } + ], + "values": [ + "2001-09-08 18:46:40:000", + "2017-07-13 19:40:00:000", + "2020-09-13 05:26:40:000", + "2021-01-06 22:13:20:000", + "2021-05-02 17:00:00:000", + "2021-08-26 10:46:40:000", + "2021-11-20 03:33:20:000", + "2022-04-14 22:20:00:000", + "2022-08-08 16:06:40:000", + "2033-05-17 20:33:20:000" + ] + } +] diff --git a/components/datetime/benches/pattern.rs b/components/datetime/benches/pattern.rs index b85b98a34ed..89f78fc225c 100644 --- a/components/datetime/benches/pattern.rs +++ b/components/datetime/benches/pattern.rs @@ -1,39 +1,18 @@ +mod fixtures; + use criterion::{criterion_group, criterion_main, Criterion}; use icu_datetime::pattern::Pattern; fn pattern_benches(c: &mut Criterion) { - let inputs = vec![ - "dd/MM/y", - "dd/MM", - "d MMM", - "d MMM y", - "MMMM y", - "d MMMM", - "HH:mm:ss", - "HH:mm", - "y", - "mm:ss", - "h:mm:ss B", - "E, h:mm B", - "E, h:mm:ss B", - "E d", - "E h:mm a", - "y G", - "MMM y G", - "dd/MM", - "E, dd/MM", - "LLL", - "E, d MMM y", - "E, dd/MM/y", - ]; + let patterns: Vec = fixtures::get_patterns_fixture().unwrap().0; { let mut group = c.benchmark_group("pattern"); group.bench_function("parse", |b| { b.iter(|| { - for input in &inputs { + for input in &patterns { let _ = Pattern::from_bytes(input.as_bytes()).unwrap(); } }) diff --git a/components/datetime/src/date.rs b/components/datetime/src/date.rs index 0d9a635c481..e3da3cfa116 100644 --- a/components/datetime/src/date.rs +++ b/components/datetime/src/date.rs @@ -1,4 +1,4 @@ -#[derive(Default)] +#[derive(Default, Debug)] pub struct DateTime { pub year: usize, pub month: usize, @@ -6,18 +6,18 @@ pub struct DateTime { pub hour: usize, pub minute: usize, pub second: usize, - pub milliseconds: usize, + pub millisecond: usize, } impl DateTime { pub fn new( - year: usize, - month: usize, - day: usize, - hour: usize, - minute: usize, - second: usize, - milliseconds: usize, + year: usize, // 0- + month: usize, // 0-11 + day: usize, // 0-31 + hour: usize, // 0-23 + minute: usize, // 0-60 + second: usize, // 0-60 + millisecond: usize, // 0-999 ) -> Self { Self { year, @@ -26,7 +26,7 @@ impl DateTime { hour, minute, second, - milliseconds, + millisecond, } } } diff --git a/components/datetime/src/format.rs b/components/datetime/src/format.rs index c436b6dc4b3..21fed4876e4 100644 --- a/components/datetime/src/format.rs +++ b/components/datetime/src/format.rs @@ -1,5 +1,5 @@ use super::date::DateTime; -use crate::fields::{FieldLength, FieldSymbol}; +use crate::fields::{self, FieldLength, FieldSymbol}; use crate::pattern::{Pattern, PatternItem}; use crate::provider::DateTimeDates; use icu_data_provider::structs; @@ -28,8 +28,8 @@ fn format_number( // Temporary simplified function to get the day of the week fn get_day_of_week(year: usize, month: usize, day: usize) -> usize { let t = &[0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]; - let year = if month < 3 { year - 1 } else { year }; - (year + year / 4 - year / 100 + year / 400 + t[month - 1] + day) % 7 + let year = if month < 2 { year - 1 } else { year }; + (year + year / 4 - year / 100 + year / 400 + t[month] + day + 1) % 7 } pub fn write_pattern( @@ -38,17 +38,17 @@ pub fn write_pattern( date_time: &DateTime, w: &mut impl fmt::Write, ) -> std::fmt::Result { - for item in pattern.0.iter() { + for item in &pattern.0 { match item { PatternItem::Field(field) => match field.symbol { FieldSymbol::Year(..) => format_number(w, date_time.year, &field.length)?, FieldSymbol::Month(month) => match field.length { FieldLength::One | FieldLength::TwoDigit => { - format_number(w, date_time.month, &field.length)? + format_number(w, date_time.month + 1, &field.length)? } length => { let symbol = data - .get_symbol_for_month(month, length, date_time.month - 1) + .get_symbol_for_month(month, length, date_time.month) .unwrap() .unwrap(); w.write_str(symbol)? @@ -62,14 +62,42 @@ pub fn write_pattern( .unwrap(); w.write_str(symbol)? } - FieldSymbol::Day(..) => format_number(w, date_time.day, &field.length)?, - FieldSymbol::Hour(..) => format_number(w, date_time.hour, &field.length)?, + FieldSymbol::Day(..) => format_number(w, date_time.day + 1, &field.length)?, + FieldSymbol::Hour(hour) => { + let value = match hour { + fields::Hour::H11 => date_time.hour % 12, + fields::Hour::H12 => { + let v = date_time.hour % 12; + if v == 0 { + 12 + } else { + v + } + } + fields::Hour::H23 => date_time.hour, + fields::Hour::H24 => { + if date_time.hour == 0 { + 24 + } else { + date_time.hour + } + } + _ => unimplemented!(), + }; + format_number(w, value, &field.length)? + } FieldSymbol::Minute => format_number(w, date_time.minute, &field.length)?, FieldSymbol::Second(..) => format_number(w, date_time.second, &field.length)?, - FieldSymbol::Period(..) => { - let symbols = &data.symbols.day_periods.format.wide.am; - w.write_str(symbols)? - } + FieldSymbol::Period(period) => match period { + fields::Period::AmPm => { + let symbol = data + .get_symbol_for_day_period(period, field.length, date_time.hour) + .unwrap() + .unwrap(); + w.write_str(symbol)? + } + _ => unimplemented!(), + }, b => unimplemented!("{:#?}", b), }, PatternItem::Literal(l) => w.write_str(l)?, diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs index c10b31ec8b5..52004665744 100644 --- a/components/datetime/src/lib.rs +++ b/components/datetime/src/lib.rs @@ -12,7 +12,7 @@ use format::write_pattern; pub use format::FormattedDateTime; use icu_data_provider::{icu_data_key, structs, DataEntry, DataProvider, DataRequest}; use icu_locale::LanguageIdentifier; -use options::DateTimeFormatOptions; +pub use options::DateTimeFormatOptions; use pattern::Pattern; use provider::DateTimeDates; use std::borrow::Cow; @@ -62,15 +62,15 @@ impl<'d> DateTimeFormat<'d> { pub fn format_to_write( &self, - value: &DateTime, w: &mut impl std::fmt::Write, + value: &DateTime, ) -> std::fmt::Result { write_pattern(&self.pattern, &self.data, value, w) } pub fn format_to_string(&self, value: &DateTime) -> String { let mut s = String::new(); - self.format_to_write(value, &mut s) + self.format_to_write(&mut s, value) .expect("Failed to write to a String."); s } diff --git a/components/datetime/src/options/mod.rs b/components/datetime/src/options/mod.rs index e9509f73559..d04758fec54 100644 --- a/components/datetime/src/options/mod.rs +++ b/components/datetime/src/options/mod.rs @@ -1,6 +1,6 @@ pub mod components; -pub mod style; pub mod preferences; +pub mod style; #[derive(Debug)] pub enum DateTimeFormatOptions { diff --git a/components/datetime/src/pattern.rs b/components/datetime/src/pattern.rs index e0ee95d98a2..ba2540ff99a 100644 --- a/components/datetime/src/pattern.rs +++ b/components/datetime/src/pattern.rs @@ -1,6 +1,5 @@ use crate::fields::{self, Field, FieldLength, FieldSymbol}; use std::iter::FromIterator; -use std::str; #[derive(Debug, PartialEq, Clone)] pub enum PatternItem { @@ -142,3 +141,37 @@ impl FromIterator for Pattern { Self(items) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn pattern_parse() { + assert_eq!( + Pattern::from_bytes(b"dd/MM/y").unwrap(), + vec![ + (fields::Day::DayOfMonth.into(), FieldLength::TwoDigit).into(), + "/".into(), + (fields::Month::Format.into(), FieldLength::TwoDigit).into(), + "/".into(), + (fields::Year::Calendar.into(), FieldLength::One).into(), + ] + .into_iter() + .collect() + ); + + assert_eq!( + Pattern::from_bytes(b"HH:mm:ss").unwrap(), + vec![ + (fields::Hour::H23.into(), FieldLength::TwoDigit).into(), + ":".into(), + (FieldSymbol::Minute, FieldLength::TwoDigit).into(), + ":".into(), + (fields::Second::Second.into(), FieldLength::TwoDigit).into(), + ] + .into_iter() + .collect() + ); + } +} diff --git a/components/datetime/src/provider.rs b/components/datetime/src/provider.rs index 390c5627ba8..bef692b0511 100644 --- a/components/datetime/src/provider.rs +++ b/components/datetime/src/provider.rs @@ -195,7 +195,9 @@ impl DateTimeDates for structs::dates::gregory::DatesV1 { _ => unimplemented!(), }; let symbols = match length { - fields::FieldLength::Abbreviated => &widths.abbreviated, + fields::FieldLength::One + | fields::FieldLength::TwoDigit + | fields::FieldLength::Abbreviated => &widths.abbreviated, fields::FieldLength::Wide => &widths.wide, fields::FieldLength::Narrow => &widths.narrow, _ => unreachable!(), diff --git a/components/datetime/tests/date.rs b/components/datetime/tests/date.rs deleted file mode 100644 index eb8b7a12588..00000000000 --- a/components/datetime/tests/date.rs +++ /dev/null @@ -1,84 +0,0 @@ -use icu_cldr_json_data_provider::{CldrJsonDataProvider, CldrPaths}; -use icu_datetime::date::DateTime; -use icu_datetime::options; -use icu_datetime::DateTimeFormat; -use std::fmt::Write; - -#[test] -fn it_works() { - let langid = "en".parse().unwrap(); - - let dt = DateTime { - year: 2020, - month: 8, - day: 5, - ..Default::default() - }; - - let mut cldr_paths = CldrPaths::default(); - - cldr_paths.cldr_dates = - Ok("/Users/zbraniecki/projects/intl-measurements/icu4x/data/cldr/cldr-dates-modern".into()); - - let provider = CldrJsonDataProvider::new(&cldr_paths); - - let dtf = DateTimeFormat::try_new( - langid, - &provider, - &options::DateTimeFormatOptions::Style(options::style::Bag { - date: options::style::Date::Short, - time: options::style::Time::None, - ..Default::default() - }), - ) - .unwrap(); - - let num = dtf.format(&dt); - - let s = num.to_string(); - assert_eq!(s, "8/5/2020"); - - let mut s = String::new(); - write!(s, "{}", num).unwrap(); - assert_eq!(s, "8/5/2020"); - - let mut s = String::new(); - dtf.format_to_write(&dt, &mut s).unwrap(); - assert_eq!(s, "8/5/2020"); - - let s = dtf.format_to_string(&dt); - assert_eq!(s, "8/5/2020"); -} - -#[test] -fn display_names() { - let langid = "en".parse().unwrap(); - let dt = DateTime { - year: 2020, - month: 8, - day: 5, - ..Default::default() - }; - - let mut cldr_paths = CldrPaths::default(); - - cldr_paths.cldr_dates = - Ok("/Users/zbraniecki/projects/intl-measurements/icu4x/data/cldr/cldr-dates-modern".into()); - - let provider = CldrJsonDataProvider::new(&cldr_paths); - - let dtf = DateTimeFormat::try_new( - langid, - &provider, - &options::DateTimeFormatOptions::Style(options::style::Bag { - date: options::style::Date::Medium, - time: options::style::Time::Short, - ..Default::default() - }), - ) - .unwrap(); - - let s = dtf.format_to_string(&dt); - - assert_eq!(s, "Aug 5, 2020, 0:00 AM"); -} diff --git a/components/datetime/tests/datetime.rs b/components/datetime/tests/datetime.rs new file mode 100644 index 00000000000..5101b53f27b --- /dev/null +++ b/components/datetime/tests/datetime.rs @@ -0,0 +1,36 @@ +mod fixtures; + +use icu_cldr_json_data_provider::{CldrJsonDataProvider, CldrPaths}; +use icu_datetime::DateTimeFormat; +use std::fmt::Write; + +#[test] +fn test_fixtures() { + let mut cldr_paths = CldrPaths::default(); + + cldr_paths.cldr_dates = Ok("./tests/fixtures/data/cldr/cldr-dates-modern".into()); + + let provider = CldrJsonDataProvider::new(&cldr_paths); + + for fx in fixtures::get_fixture("styles").unwrap().0 { + let langid = fx.input.locale.parse().unwrap(); + let options = fixtures::get_options(&fx.input.options); + let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); + + let value = fixtures::parse_date(&fx.input.value).unwrap(); + + let result = dtf.format_to_string(&value); + assert_eq!(result, fx.output.value); + + let mut s = String::new(); + dtf.format_to_write(&mut s, &value).unwrap(); + assert_eq!(s, fx.output.value); + + let fdt = dtf.format(&value); + assert_eq!(fdt.to_string(), fx.output.value); + + let mut s = String::new(); + write!(s, "{}", fdt).unwrap(); + assert_eq!(s, fx.output.value); + } +} diff --git a/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/ca-generic.json b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/ca-generic.json new file mode 100755 index 00000000000..c522c5f5732 --- /dev/null +++ b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/ca-generic.json @@ -0,0 +1,536 @@ +{ + "main": { + "en": { + "identity": { + "version": { + "_cldrVersion": "37" + }, + "language": "en" + }, + "dates": { + "calendars": { + "generic": { + "months": { + "format": { + "abbreviated": { + "1": "M01", + "2": "M02", + "3": "M03", + "4": "M04", + "5": "M05", + "6": "M06", + "7": "M07", + "8": "M08", + "9": "M09", + "10": "M10", + "11": "M11", + "12": "M12" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "10": "10", + "11": "11", + "12": "12" + }, + "wide": { + "1": "M01", + "2": "M02", + "3": "M03", + "4": "M04", + "5": "M05", + "6": "M06", + "7": "M07", + "8": "M08", + "9": "M09", + "10": "M10", + "11": "M11", + "12": "M12" + } + }, + "stand-alone": { + "abbreviated": { + "1": "M01", + "2": "M02", + "3": "M03", + "4": "M04", + "5": "M05", + "6": "M06", + "7": "M07", + "8": "M08", + "9": "M09", + "10": "M10", + "11": "M11", + "12": "M12" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "10": "10", + "11": "11", + "12": "12" + }, + "wide": { + "1": "M01", + "2": "M02", + "3": "M03", + "4": "M04", + "5": "M05", + "6": "M06", + "7": "M07", + "8": "M08", + "9": "M09", + "10": "M10", + "11": "M11", + "12": "M12" + } + } + }, + "days": { + "format": { + "abbreviated": { + "sun": "Sun", + "mon": "Mon", + "tue": "Tue", + "wed": "Wed", + "thu": "Thu", + "fri": "Fri", + "sat": "Sat" + }, + "narrow": { + "sun": "S", + "mon": "M", + "tue": "T", + "wed": "W", + "thu": "T", + "fri": "F", + "sat": "S" + }, + "short": { + "sun": "Su", + "mon": "Mo", + "tue": "Tu", + "wed": "We", + "thu": "Th", + "fri": "Fr", + "sat": "Sa" + }, + "wide": { + "sun": "Sunday", + "mon": "Monday", + "tue": "Tuesday", + "wed": "Wednesday", + "thu": "Thursday", + "fri": "Friday", + "sat": "Saturday" + } + }, + "stand-alone": { + "abbreviated": { + "sun": "Sun", + "mon": "Mon", + "tue": "Tue", + "wed": "Wed", + "thu": "Thu", + "fri": "Fri", + "sat": "Sat" + }, + "narrow": { + "sun": "S", + "mon": "M", + "tue": "T", + "wed": "W", + "thu": "T", + "fri": "F", + "sat": "S" + }, + "short": { + "sun": "Su", + "mon": "Mo", + "tue": "Tu", + "wed": "We", + "thu": "Th", + "fri": "Fr", + "sat": "Sa" + }, + "wide": { + "sun": "Sunday", + "mon": "Monday", + "tue": "Tuesday", + "wed": "Wednesday", + "thu": "Thursday", + "fri": "Friday", + "sat": "Saturday" + } + } + }, + "quarters": { + "format": { + "abbreviated": { + "1": "Q1", + "2": "Q2", + "3": "Q3", + "4": "Q4" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "1st quarter", + "2": "2nd quarter", + "3": "3rd quarter", + "4": "4th quarter" + } + }, + "stand-alone": { + "abbreviated": { + "1": "Q1", + "2": "Q2", + "3": "Q3", + "4": "Q4" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "1st quarter", + "2": "2nd quarter", + "3": "3rd quarter", + "4": "4th quarter" + } + } + }, + "dayPeriods": { + "format": { + "abbreviated": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "in the morning", + "afternoon1": "in the afternoon", + "evening1": "in the evening", + "night1": "at night" + }, + "narrow": { + "midnight": "mi", + "am": "a", + "am-alt-variant": "am", + "noon": "n", + "pm": "p", + "pm-alt-variant": "pm", + "morning1": "in the morning", + "afternoon1": "in the afternoon", + "evening1": "in the evening", + "night1": "at night" + }, + "wide": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "in the morning", + "afternoon1": "in the afternoon", + "evening1": "in the evening", + "night1": "at night" + } + }, + "stand-alone": { + "abbreviated": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "morning", + "afternoon1": "afternoon", + "evening1": "evening", + "night1": "night" + }, + "narrow": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "morning", + "afternoon1": "afternoon", + "evening1": "evening", + "night1": "night" + }, + "wide": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "morning", + "afternoon1": "afternoon", + "evening1": "evening", + "night1": "night" + } + } + }, + "eras": { + "eraNames": { + "0": "ERA0", + "1": "ERA1" + }, + "eraAbbr": { + "0": "ERA0", + "1": "ERA1" + }, + "eraNarrow": { + "0": "ERA0", + "1": "ERA1" + } + }, + "dateFormats": { + "full": "EEEE, MMMM d, y G", + "long": "MMMM d, y G", + "medium": "MMM d, y G", + "short": "M/d/y GGGGG" + }, + "timeFormats": { + "full": "h:mm:ss a zzzz", + "long": "h:mm:ss a z", + "medium": "h:mm:ss a", + "short": "h:mm a" + }, + "dateTimeFormats": { + "full": "{1} 'at' {0}", + "long": "{1} 'at' {0}", + "medium": "{1}, {0}", + "short": "{1}, {0}", + "availableFormats": { + "Bh": "h B", + "Bhm": "h:mm B", + "Bhms": "h:mm:ss B", + "d": "d", + "E": "ccc", + "EBhm": "E h:mm B", + "EBhms": "E h:mm:ss B", + "Ed": "d E", + "Ehm": "E h:mm a", + "EHm": "E HH:mm", + "Ehms": "E h:mm:ss a", + "EHms": "E HH:mm:ss", + "Gy": "y G", + "GyMMM": "MMM y G", + "GyMMMd": "MMM d, y G", + "GyMMMEd": "E, MMM d, y G", + "h": "h a", + "H": "HH", + "hm": "h:mm a", + "Hm": "HH:mm", + "hms": "h:mm:ss a", + "Hms": "HH:mm:ss", + "M": "L", + "Md": "M/d", + "MEd": "E, M/d", + "MMM": "LLL", + "MMMd": "MMM d", + "MMMEd": "E, MMM d", + "MMMMd": "MMMM d", + "ms": "mm:ss", + "y": "y G", + "yyyy": "y G", + "yyyyM": "M/y GGGGG", + "yyyyMd": "M/d/y GGGGG", + "yyyyMEd": "E, M/d/y GGGGG", + "yyyyMMM": "MMM y G", + "yyyyMMMd": "MMM d, y G", + "yyyyMMMEd": "E, MMM d, y G", + "yyyyMMMM": "MMMM y G", + "yyyyQQQ": "QQQ y G", + "yyyyQQQQ": "QQQQ y G" + }, + "appendItems": { + "Day": "{0} ({2}: {1})", + "Day-Of-Week": "{0} {1}", + "Era": "{0} {1}", + "Hour": "{0} ({2}: {1})", + "Minute": "{0} ({2}: {1})", + "Month": "{0} ({2}: {1})", + "Quarter": "{0} ({2}: {1})", + "Second": "{0} ({2}: {1})", + "Timezone": "{0} {1}", + "Week": "{0} ({2}: {1})", + "Year": "{0} {1}" + }, + "intervalFormats": { + "intervalFormatFallback": "{0} – {1}", + "Bh": { + "B": "h B – h B", + "h": "h – h B" + }, + "Bhm": { + "B": "h:mm B – h:mm B", + "h": "h:mm – h:mm B", + "m": "h:mm – h:mm B" + }, + "d": { + "d": "d – d" + }, + "Gy": { + "G": "y G – y G", + "y": "y – y G" + }, + "GyM": { + "G": "M/y GGGGG – M/y GGGGG", + "M": "M/y – M/y GGGGG", + "y": "M/y – M/y GGGGG" + }, + "GyMd": { + "d": "M/d/y – M/d/y GGGGG", + "G": "M/d/y GGGGG – M/d/y GGGGG", + "M": "M/d/y – M/d/y GGGGG", + "y": "M/d/y – M/d/y GGGGG" + }, + "GyMEd": { + "d": "E, M/d/y – E, M/d/y GGGGG", + "G": "E, M/d/y GGGGG – E, M/d/y GGGGG", + "M": "E, M/d/y – E, M/d/y GGGGG", + "y": "E, M/d/y – E, M/d/y GGGGG" + }, + "GyMMM": { + "G": "MMM y G – MMM y G", + "M": "MMM – MMM y G", + "y": "MMM y – MMM y G" + }, + "GyMMMd": { + "d": "MMM d – d, y G", + "G": "MMM d, y G – MMM d, y G", + "M": "MMM d – MMM d, y G", + "y": "MMM d, y – MMM d, y G" + }, + "GyMMMEd": { + "d": "E, MMM d – E, MMM d, y G", + "G": "E, MMM d, y G – E, MMM d, y G", + "M": "E, MMM d – E, MMM d, y G", + "y": "E, MMM d, y – E, MMM d, y G" + }, + "h": { + "a": "h a – h a", + "h": "h – h a" + }, + "H": { + "H": "HH – HH" + }, + "hm": { + "a": "h:mm a – h:mm a", + "h": "h:mm – h:mm a", + "m": "h:mm – h:mm a" + }, + "Hm": { + "H": "HH:mm – HH:mm", + "m": "HH:mm – HH:mm" + }, + "hmv": { + "a": "h:mm a – h:mm a v", + "h": "h:mm – h:mm a v", + "m": "h:mm – h:mm a v" + }, + "Hmv": { + "H": "HH:mm – HH:mm v", + "m": "HH:mm – HH:mm v" + }, + "hv": { + "a": "h a – h a v", + "h": "h – h a v" + }, + "Hv": { + "H": "HH – HH v" + }, + "M": { + "M": "M – M" + }, + "Md": { + "d": "M/d – M/d", + "M": "M/d – M/d" + }, + "MEd": { + "d": "E, M/d – E, M/d", + "M": "E, M/d – E, M/d" + }, + "MMM": { + "M": "MMM – MMM" + }, + "MMMd": { + "d": "MMM d – d", + "M": "MMM d – MMM d" + }, + "MMMEd": { + "d": "E, MMM d – E, MMM d", + "M": "E, MMM d – E, MMM d" + }, + "y": { + "y": "y – y G" + }, + "yM": { + "M": "M/y – M/y GGGGG", + "y": "M/y – M/y GGGGG" + }, + "yMd": { + "d": "M/d/y – M/d/y GGGGG", + "M": "M/d/y – M/d/y GGGGG", + "y": "M/d/y – M/d/y GGGGG" + }, + "yMEd": { + "d": "E, M/d/y – E, M/d/y GGGGG", + "M": "E, M/d/y – E, M/d/y GGGGG", + "y": "E, M/d/y – E, M/d/y GGGGG" + }, + "yMMM": { + "M": "MMM – MMM y G", + "y": "MMM y – MMM y G" + }, + "yMMMd": { + "d": "MMM d – d, y G", + "M": "MMM d – MMM d, y G", + "y": "MMM d, y – MMM d, y G" + }, + "yMMMEd": { + "d": "E, MMM d – E, MMM d, y G", + "M": "E, MMM d – E, MMM d, y G", + "y": "E, MMM d, y – E, MMM d, y G" + }, + "yMMMM": { + "M": "MMMM – MMMM y G", + "y": "MMMM y – MMMM y G" + } + } + } + } + } + } + } + } +} diff --git a/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/ca-gregorian.json b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/ca-gregorian.json new file mode 100755 index 00000000000..75b12fb3913 --- /dev/null +++ b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/ca-gregorian.json @@ -0,0 +1,549 @@ +{ + "main": { + "en": { + "identity": { + "version": { + "_cldrVersion": "37" + }, + "language": "en" + }, + "dates": { + "calendars": { + "gregorian": { + "months": { + "format": { + "abbreviated": { + "1": "Jan", + "2": "Feb", + "3": "Mar", + "4": "Apr", + "5": "May", + "6": "Jun", + "7": "Jul", + "8": "Aug", + "9": "Sep", + "10": "Oct", + "11": "Nov", + "12": "Dec" + }, + "narrow": { + "1": "J", + "2": "F", + "3": "M", + "4": "A", + "5": "M", + "6": "J", + "7": "J", + "8": "A", + "9": "S", + "10": "O", + "11": "N", + "12": "D" + }, + "wide": { + "1": "January", + "2": "February", + "3": "March", + "4": "April", + "5": "May", + "6": "June", + "7": "July", + "8": "August", + "9": "September", + "10": "October", + "11": "November", + "12": "December" + } + }, + "stand-alone": { + "abbreviated": { + "1": "Jan", + "2": "Feb", + "3": "Mar", + "4": "Apr", + "5": "May", + "6": "Jun", + "7": "Jul", + "8": "Aug", + "9": "Sep", + "10": "Oct", + "11": "Nov", + "12": "Dec" + }, + "narrow": { + "1": "J", + "2": "F", + "3": "M", + "4": "A", + "5": "M", + "6": "J", + "7": "J", + "8": "A", + "9": "S", + "10": "O", + "11": "N", + "12": "D" + }, + "wide": { + "1": "January", + "2": "February", + "3": "March", + "4": "April", + "5": "May", + "6": "June", + "7": "July", + "8": "August", + "9": "September", + "10": "October", + "11": "November", + "12": "December" + } + } + }, + "days": { + "format": { + "abbreviated": { + "sun": "Sun", + "mon": "Mon", + "tue": "Tue", + "wed": "Wed", + "thu": "Thu", + "fri": "Fri", + "sat": "Sat" + }, + "narrow": { + "sun": "S", + "mon": "M", + "tue": "T", + "wed": "W", + "thu": "T", + "fri": "F", + "sat": "S" + }, + "short": { + "sun": "Su", + "mon": "Mo", + "tue": "Tu", + "wed": "We", + "thu": "Th", + "fri": "Fr", + "sat": "Sa" + }, + "wide": { + "sun": "Sunday", + "mon": "Monday", + "tue": "Tuesday", + "wed": "Wednesday", + "thu": "Thursday", + "fri": "Friday", + "sat": "Saturday" + } + }, + "stand-alone": { + "abbreviated": { + "sun": "Sun", + "mon": "Mon", + "tue": "Tue", + "wed": "Wed", + "thu": "Thu", + "fri": "Fri", + "sat": "Sat" + }, + "narrow": { + "sun": "S", + "mon": "M", + "tue": "T", + "wed": "W", + "thu": "T", + "fri": "F", + "sat": "S" + }, + "short": { + "sun": "Su", + "mon": "Mo", + "tue": "Tu", + "wed": "We", + "thu": "Th", + "fri": "Fr", + "sat": "Sa" + }, + "wide": { + "sun": "Sunday", + "mon": "Monday", + "tue": "Tuesday", + "wed": "Wednesday", + "thu": "Thursday", + "fri": "Friday", + "sat": "Saturday" + } + } + }, + "quarters": { + "format": { + "abbreviated": { + "1": "Q1", + "2": "Q2", + "3": "Q3", + "4": "Q4" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "1st quarter", + "2": "2nd quarter", + "3": "3rd quarter", + "4": "4th quarter" + } + }, + "stand-alone": { + "abbreviated": { + "1": "Q1", + "2": "Q2", + "3": "Q3", + "4": "Q4" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "1st quarter", + "2": "2nd quarter", + "3": "3rd quarter", + "4": "4th quarter" + } + } + }, + "dayPeriods": { + "format": { + "abbreviated": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "in the morning", + "afternoon1": "in the afternoon", + "evening1": "in the evening", + "night1": "at night" + }, + "narrow": { + "midnight": "mi", + "am": "a", + "am-alt-variant": "am", + "noon": "n", + "pm": "p", + "pm-alt-variant": "pm", + "morning1": "in the morning", + "afternoon1": "in the afternoon", + "evening1": "in the evening", + "night1": "at night" + }, + "wide": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "in the morning", + "afternoon1": "in the afternoon", + "evening1": "in the evening", + "night1": "at night" + } + }, + "stand-alone": { + "abbreviated": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "morning", + "afternoon1": "afternoon", + "evening1": "evening", + "night1": "night" + }, + "narrow": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "morning", + "afternoon1": "afternoon", + "evening1": "evening", + "night1": "night" + }, + "wide": { + "midnight": "midnight", + "am": "AM", + "am-alt-variant": "am", + "noon": "noon", + "pm": "PM", + "pm-alt-variant": "pm", + "morning1": "morning", + "afternoon1": "afternoon", + "evening1": "evening", + "night1": "night" + } + } + }, + "eras": { + "eraNames": { + "0": "Before Christ", + "0-alt-variant": "Before Common Era", + "1": "Anno Domini", + "1-alt-variant": "Common Era" + }, + "eraAbbr": { + "0": "BC", + "0-alt-variant": "BCE", + "1": "AD", + "1-alt-variant": "CE" + }, + "eraNarrow": { + "0": "B", + "0-alt-variant": "BCE", + "1": "A", + "1-alt-variant": "CE" + } + }, + "dateFormats": { + "full": "EEEE, MMMM d, y", + "long": "MMMM d, y", + "medium": "MMM d, y", + "short": "M/d/yy" + }, + "timeFormats": { + "full": "h:mm:ss a zzzz", + "long": "h:mm:ss a z", + "medium": "h:mm:ss a", + "short": "h:mm a" + }, + "dateTimeFormats": { + "full": "{1} 'at' {0}", + "long": "{1} 'at' {0}", + "medium": "{1}, {0}", + "short": "{1}, {0}", + "availableFormats": { + "Bh": "h B", + "Bhm": "h:mm B", + "Bhms": "h:mm:ss B", + "d": "d", + "E": "ccc", + "EBhm": "E h:mm B", + "EBhms": "E h:mm:ss B", + "Ed": "d E", + "Ehm": "E h:mm a", + "EHm": "E HH:mm", + "Ehms": "E h:mm:ss a", + "EHms": "E HH:mm:ss", + "Gy": "y G", + "GyMMM": "MMM y G", + "GyMMMd": "MMM d, y G", + "GyMMMEd": "E, MMM d, y G", + "h": "h a", + "H": "HH", + "hm": "h:mm a", + "Hm": "HH:mm", + "hms": "h:mm:ss a", + "Hms": "HH:mm:ss", + "hmsv": "h:mm:ss a v", + "Hmsv": "HH:mm:ss v", + "hmv": "h:mm a v", + "Hmv": "HH:mm v", + "M": "L", + "Md": "M/d", + "MEd": "E, M/d", + "MMM": "LLL", + "MMMd": "MMM d", + "MMMEd": "E, MMM d", + "MMMMd": "MMMM d", + "MMMMW-count-one": "'week' W 'of' MMMM", + "MMMMW-count-other": "'week' W 'of' MMMM", + "ms": "mm:ss", + "y": "y", + "yM": "M/y", + "yMd": "M/d/y", + "yMEd": "E, M/d/y", + "yMMM": "MMM y", + "yMMMd": "MMM d, y", + "yMMMEd": "E, MMM d, y", + "yMMMM": "MMMM y", + "yQQQ": "QQQ y", + "yQQQQ": "QQQQ y", + "yw-count-one": "'week' w 'of' Y", + "yw-count-other": "'week' w 'of' Y" + }, + "appendItems": { + "Day": "{0} ({2}: {1})", + "Day-Of-Week": "{0} {1}", + "Era": "{0} {1}", + "Hour": "{0} ({2}: {1})", + "Minute": "{0} ({2}: {1})", + "Month": "{0} ({2}: {1})", + "Quarter": "{0} ({2}: {1})", + "Second": "{0} ({2}: {1})", + "Timezone": "{0} {1}", + "Week": "{0} ({2}: {1})", + "Year": "{0} {1}" + }, + "intervalFormats": { + "intervalFormatFallback": "{0} – {1}", + "Bh": { + "B": "h B – h B", + "h": "h – h B" + }, + "Bhm": { + "B": "h:mm B – h:mm B", + "h": "h:mm – h:mm B", + "m": "h:mm – h:mm B" + }, + "d": { + "d": "d – d" + }, + "Gy": { + "G": "y G – y G", + "y": "y – y G" + }, + "GyM": { + "G": "M/y GGGGG – M/y GGGGG", + "M": "M/y – M/y GGGGG", + "y": "M/y – M/y GGGGG" + }, + "GyMd": { + "d": "M/d/y – M/d/y GGGGG", + "G": "M/d/y GGGGG – M/d/y GGGGG", + "M": "M/d/y – M/d/y GGGGG", + "y": "M/d/y – M/d/y GGGGG" + }, + "GyMEd": { + "d": "E, M/d/y – E, M/d/y GGGGG", + "G": "E, M/d/y GGGGG – E, M/d/y GGGGG", + "M": "E, M/d/y – E, M/d/y GGGGG", + "y": "E, M/d/y – E, M/d/y GGGGG" + }, + "GyMMM": { + "G": "MMM y G – MMM y G", + "M": "MMM – MMM y G", + "y": "MMM y – MMM y G" + }, + "GyMMMd": { + "d": "MMM d – d, y G", + "G": "MMM d, y G – MMM d, y G", + "M": "MMM d – MMM d, y G", + "y": "MMM d, y – MMM d, y G" + }, + "GyMMMEd": { + "d": "E, MMM d – E, MMM d, y G", + "G": "E, MMM d, y G – E, MMM d, y G", + "M": "E, MMM d – E, MMM d, y G", + "y": "E, MMM d, y – E, MMM d, y G" + }, + "h": { + "a": "h a – h a", + "h": "h – h a" + }, + "H": { + "H": "HH – HH" + }, + "hm": { + "a": "h:mm a – h:mm a", + "h": "h:mm – h:mm a", + "m": "h:mm – h:mm a" + }, + "Hm": { + "H": "HH:mm – HH:mm", + "m": "HH:mm – HH:mm" + }, + "hmv": { + "a": "h:mm a – h:mm a v", + "h": "h:mm – h:mm a v", + "m": "h:mm – h:mm a v" + }, + "Hmv": { + "H": "HH:mm – HH:mm v", + "m": "HH:mm – HH:mm v" + }, + "hv": { + "a": "h a – h a v", + "h": "h – h a v" + }, + "Hv": { + "H": "HH – HH v" + }, + "M": { + "M": "M – M" + }, + "Md": { + "d": "M/d – M/d", + "M": "M/d – M/d" + }, + "MEd": { + "d": "E, M/d – E, M/d", + "M": "E, M/d – E, M/d" + }, + "MMM": { + "M": "MMM – MMM" + }, + "MMMd": { + "d": "MMM d – d", + "M": "MMM d – MMM d" + }, + "MMMEd": { + "d": "E, MMM d – E, MMM d", + "M": "E, MMM d – E, MMM d" + }, + "y": { + "y": "y – y" + }, + "yM": { + "M": "M/y – M/y", + "y": "M/y – M/y" + }, + "yMd": { + "d": "M/d/y – M/d/y", + "M": "M/d/y – M/d/y", + "y": "M/d/y – M/d/y" + }, + "yMEd": { + "d": "E, M/d/y – E, M/d/y", + "M": "E, M/d/y – E, M/d/y", + "y": "E, M/d/y – E, M/d/y" + }, + "yMMM": { + "M": "MMM – MMM y", + "y": "MMM y – MMM y" + }, + "yMMMd": { + "d": "MMM d – d, y", + "M": "MMM d – MMM d, y", + "y": "MMM d, y – MMM d, y" + }, + "yMMMEd": { + "d": "E, MMM d – E, MMM d, y", + "M": "E, MMM d – E, MMM d, y", + "y": "E, MMM d, y – E, MMM d, y" + }, + "yMMMM": { + "M": "MMMM – MMMM y", + "y": "MMMM y – MMMM y" + } + } + } + } + } + } + } + } +} diff --git a/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/dateFields.json b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/dateFields.json new file mode 100755 index 00000000000..ca404042a5b --- /dev/null +++ b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/dateFields.json @@ -0,0 +1,676 @@ +{ + "main": { + "en": { + "identity": { + "version": { + "_cldrVersion": "37" + }, + "language": "en" + }, + "dates": { + "fields": { + "era": { + "displayName": "era" + }, + "era-short": { + "displayName": "era" + }, + "era-narrow": { + "displayName": "era" + }, + "year": { + "displayName": "year", + "relative-type--1": "last year", + "relative-type-0": "this year", + "relative-type-1": "next year", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} year", + "relativeTimePattern-count-other": "in {0} years" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} year ago", + "relativeTimePattern-count-other": "{0} years ago" + } + }, + "year-short": { + "displayName": "yr.", + "relative-type--1": "last yr.", + "relative-type-0": "this yr.", + "relative-type-1": "next yr.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} yr.", + "relativeTimePattern-count-other": "in {0} yr." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} yr. ago", + "relativeTimePattern-count-other": "{0} yr. ago" + } + }, + "year-narrow": { + "displayName": "yr.", + "relative-type--1": "last yr.", + "relative-type-0": "this yr.", + "relative-type-1": "next yr.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} yr.", + "relativeTimePattern-count-other": "in {0} yr." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} yr. ago", + "relativeTimePattern-count-other": "{0} yr. ago" + } + }, + "quarter": { + "displayName": "quarter", + "relative-type--1": "last quarter", + "relative-type-0": "this quarter", + "relative-type-1": "next quarter", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} quarter", + "relativeTimePattern-count-other": "in {0} quarters" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} quarter ago", + "relativeTimePattern-count-other": "{0} quarters ago" + } + }, + "quarter-short": { + "displayName": "qtr.", + "relative-type--1": "last qtr.", + "relative-type-0": "this qtr.", + "relative-type-1": "next qtr.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} qtr.", + "relativeTimePattern-count-other": "in {0} qtrs." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} qtr. ago", + "relativeTimePattern-count-other": "{0} qtrs. ago" + } + }, + "quarter-narrow": { + "displayName": "qtr.", + "relative-type--1": "last qtr.", + "relative-type-0": "this qtr.", + "relative-type-1": "next qtr.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} qtr.", + "relativeTimePattern-count-other": "in {0} qtrs." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} qtr. ago", + "relativeTimePattern-count-other": "{0} qtrs. ago" + } + }, + "month": { + "displayName": "month", + "relative-type--1": "last month", + "relative-type-0": "this month", + "relative-type-1": "next month", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} month", + "relativeTimePattern-count-other": "in {0} months" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} month ago", + "relativeTimePattern-count-other": "{0} months ago" + } + }, + "month-short": { + "displayName": "mo.", + "relative-type--1": "last mo.", + "relative-type-0": "this mo.", + "relative-type-1": "next mo.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} mo.", + "relativeTimePattern-count-other": "in {0} mo." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} mo. ago", + "relativeTimePattern-count-other": "{0} mo. ago" + } + }, + "month-narrow": { + "displayName": "mo.", + "relative-type--1": "last mo.", + "relative-type-0": "this mo.", + "relative-type-1": "next mo.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} mo.", + "relativeTimePattern-count-other": "in {0} mo." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} mo. ago", + "relativeTimePattern-count-other": "{0} mo. ago" + } + }, + "week": { + "displayName": "week", + "relative-type--1": "last week", + "relative-type-0": "this week", + "relative-type-1": "next week", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} week", + "relativeTimePattern-count-other": "in {0} weeks" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} week ago", + "relativeTimePattern-count-other": "{0} weeks ago" + }, + "relativePeriod": "the week of {0}" + }, + "week-short": { + "displayName": "wk.", + "relative-type--1": "last wk.", + "relative-type-0": "this wk.", + "relative-type-1": "next wk.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} wk.", + "relativeTimePattern-count-other": "in {0} wk." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} wk. ago", + "relativeTimePattern-count-other": "{0} wk. ago" + }, + "relativePeriod": "the week of {0}" + }, + "week-narrow": { + "displayName": "wk.", + "relative-type--1": "last wk.", + "relative-type-0": "this wk.", + "relative-type-1": "next wk.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} wk.", + "relativeTimePattern-count-other": "in {0} wk." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} wk. ago", + "relativeTimePattern-count-other": "{0} wk. ago" + }, + "relativePeriod": "the week of {0}" + }, + "weekOfMonth": { + "displayName": "week of month" + }, + "weekOfMonth-short": { + "displayName": "wk. of mo." + }, + "weekOfMonth-narrow": { + "displayName": "wk. of mo." + }, + "day": { + "displayName": "day", + "relative-type--1": "yesterday", + "relative-type-0": "today", + "relative-type-1": "tomorrow", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} day", + "relativeTimePattern-count-other": "in {0} days" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} day ago", + "relativeTimePattern-count-other": "{0} days ago" + } + }, + "day-short": { + "displayName": "day", + "relative-type--1": "yesterday", + "relative-type-0": "today", + "relative-type-1": "tomorrow", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} day", + "relativeTimePattern-count-other": "in {0} days" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} day ago", + "relativeTimePattern-count-other": "{0} days ago" + } + }, + "day-narrow": { + "displayName": "day", + "relative-type--1": "yesterday", + "relative-type-0": "today", + "relative-type-1": "tomorrow", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} day", + "relativeTimePattern-count-other": "in {0} days" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} day ago", + "relativeTimePattern-count-other": "{0} days ago" + } + }, + "dayOfYear": { + "displayName": "day of year" + }, + "dayOfYear-short": { + "displayName": "day of yr." + }, + "dayOfYear-narrow": { + "displayName": "day of yr." + }, + "weekday": { + "displayName": "day of the week" + }, + "weekday-short": { + "displayName": "day of wk." + }, + "weekday-narrow": { + "displayName": "day of wk." + }, + "weekdayOfMonth": { + "displayName": "weekday of the month" + }, + "weekdayOfMonth-short": { + "displayName": "wkday. of mo." + }, + "weekdayOfMonth-narrow": { + "displayName": "wkday. of mo." + }, + "sun": { + "relative-type--1": "last Sunday", + "relative-type-0": "this Sunday", + "relative-type-1": "next Sunday", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Sunday", + "relativeTimePattern-count-other": "in {0} Sundays" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Sunday ago", + "relativeTimePattern-count-other": "{0} Sundays ago" + } + }, + "sun-short": { + "relative-type--1": "last Sun.", + "relative-type-0": "this Sun.", + "relative-type-1": "next Sun.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Sun.", + "relativeTimePattern-count-other": "in {0} Sun." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Sun. ago", + "relativeTimePattern-count-other": "{0} Sun. ago" + } + }, + "sun-narrow": { + "relative-type--1": "last Su", + "relative-type-0": "this Su", + "relative-type-1": "next Su", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Su", + "relativeTimePattern-count-other": "in {0} Su" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Su ago", + "relativeTimePattern-count-other": "{0} Su ago" + } + }, + "mon": { + "relative-type--1": "last Monday", + "relative-type-0": "this Monday", + "relative-type-1": "next Monday", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Monday", + "relativeTimePattern-count-other": "in {0} Mondays" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Monday ago", + "relativeTimePattern-count-other": "{0} Mondays ago" + } + }, + "mon-short": { + "relative-type--1": "last Mon.", + "relative-type-0": "this Mon.", + "relative-type-1": "next Mon.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Mon.", + "relativeTimePattern-count-other": "in {0} Mon." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Mon. ago", + "relativeTimePattern-count-other": "{0} Mon. ago" + } + }, + "mon-narrow": { + "relative-type--1": "last M", + "relative-type-0": "this M", + "relative-type-1": "next M", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} M", + "relativeTimePattern-count-other": "in {0} M" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} M ago", + "relativeTimePattern-count-other": "{0} M ago" + } + }, + "tue": { + "relative-type--1": "last Tuesday", + "relative-type-0": "this Tuesday", + "relative-type-1": "next Tuesday", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Tuesday", + "relativeTimePattern-count-other": "in {0} Tuesdays" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Tuesday ago", + "relativeTimePattern-count-other": "{0} Tuesdays ago" + } + }, + "tue-short": { + "relative-type--1": "last Tue.", + "relative-type-0": "this Tue.", + "relative-type-1": "next Tue.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Tue.", + "relativeTimePattern-count-other": "in {0} Tue." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Tue. ago", + "relativeTimePattern-count-other": "{0} Tue. ago" + } + }, + "tue-narrow": { + "relative-type--1": "last Tu", + "relative-type-0": "this Tu", + "relative-type-1": "next Tu", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Tu", + "relativeTimePattern-count-other": "in {0} Tu" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Tu ago", + "relativeTimePattern-count-other": "{0} Tu ago" + } + }, + "wed": { + "relative-type--1": "last Wednesday", + "relative-type-0": "this Wednesday", + "relative-type-1": "next Wednesday", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Wednesday", + "relativeTimePattern-count-other": "in {0} Wednesdays" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Wednesday ago", + "relativeTimePattern-count-other": "{0} Wednesdays ago" + } + }, + "wed-short": { + "relative-type--1": "last Wed.", + "relative-type-0": "this Wed.", + "relative-type-1": "next Wed.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Wed.", + "relativeTimePattern-count-other": "in {0} Wed." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Wed. ago", + "relativeTimePattern-count-other": "{0} Wed. ago" + } + }, + "wed-narrow": { + "relative-type--1": "last W", + "relative-type-0": "this W", + "relative-type-1": "next W", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} W", + "relativeTimePattern-count-other": "in {0} W" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} W ago", + "relativeTimePattern-count-other": "{0} W ago" + } + }, + "thu": { + "relative-type--1": "last Thursday", + "relative-type-0": "this Thursday", + "relative-type-1": "next Thursday", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Thursday", + "relativeTimePattern-count-other": "in {0} Thursdays" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Thursday ago", + "relativeTimePattern-count-other": "{0} Thursdays ago" + } + }, + "thu-short": { + "relative-type--1": "last Thu.", + "relative-type-0": "this Thu.", + "relative-type-1": "next Thu.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Thu.", + "relativeTimePattern-count-other": "in {0} Thu." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Thu. ago", + "relativeTimePattern-count-other": "{0} Thu. ago" + } + }, + "thu-narrow": { + "relative-type--1": "last Th", + "relative-type-0": "this Th", + "relative-type-1": "next Th", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Th", + "relativeTimePattern-count-other": "in {0} Th" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Th ago", + "relativeTimePattern-count-other": "{0} Th ago" + } + }, + "fri": { + "relative-type--1": "last Friday", + "relative-type-0": "this Friday", + "relative-type-1": "next Friday", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Friday", + "relativeTimePattern-count-other": "in {0} Fridays" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Friday ago", + "relativeTimePattern-count-other": "{0} Fridays ago" + } + }, + "fri-short": { + "relative-type--1": "last Fri.", + "relative-type-0": "this Fri.", + "relative-type-1": "next Fri.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Fri.", + "relativeTimePattern-count-other": "in {0} Fri." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Fri. ago", + "relativeTimePattern-count-other": "{0} Fri. ago" + } + }, + "fri-narrow": { + "relative-type--1": "last F", + "relative-type-0": "this F", + "relative-type-1": "next F", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} F", + "relativeTimePattern-count-other": "in {0} F" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} F ago", + "relativeTimePattern-count-other": "{0} F ago" + } + }, + "sat": { + "relative-type--1": "last Saturday", + "relative-type-0": "this Saturday", + "relative-type-1": "next Saturday", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Saturday", + "relativeTimePattern-count-other": "in {0} Saturdays" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Saturday ago", + "relativeTimePattern-count-other": "{0} Saturdays ago" + } + }, + "sat-short": { + "relative-type--1": "last Sat.", + "relative-type-0": "this Sat.", + "relative-type-1": "next Sat.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Sat.", + "relativeTimePattern-count-other": "in {0} Sat." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Sat. ago", + "relativeTimePattern-count-other": "{0} Sat. ago" + } + }, + "sat-narrow": { + "relative-type--1": "last Sa", + "relative-type-0": "this Sa", + "relative-type-1": "next Sa", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} Sa", + "relativeTimePattern-count-other": "in {0} Sa" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} Sa ago", + "relativeTimePattern-count-other": "{0} Sa ago" + } + }, + "dayperiod-short": { + "displayName": "AM/PM", + "displayName-alt-variant": "am/pm" + }, + "dayperiod": { + "displayName": "AM/PM", + "displayName-alt-variant": "am/pm" + }, + "dayperiod-narrow": { + "displayName": "AM/PM", + "displayName-alt-variant": "am/pm" + }, + "hour": { + "displayName": "hour", + "relative-type-0": "this hour", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} hour", + "relativeTimePattern-count-other": "in {0} hours" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} hour ago", + "relativeTimePattern-count-other": "{0} hours ago" + } + }, + "hour-short": { + "displayName": "hr.", + "relative-type-0": "this hour", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} hr.", + "relativeTimePattern-count-other": "in {0} hr." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} hr. ago", + "relativeTimePattern-count-other": "{0} hr. ago" + } + }, + "hour-narrow": { + "displayName": "hr.", + "relative-type-0": "this hour", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} hr.", + "relativeTimePattern-count-other": "in {0} hr." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} hr. ago", + "relativeTimePattern-count-other": "{0} hr. ago" + } + }, + "minute": { + "displayName": "minute", + "relative-type-0": "this minute", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} minute", + "relativeTimePattern-count-other": "in {0} minutes" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} minute ago", + "relativeTimePattern-count-other": "{0} minutes ago" + } + }, + "minute-short": { + "displayName": "min.", + "relative-type-0": "this minute", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} min.", + "relativeTimePattern-count-other": "in {0} min." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} min. ago", + "relativeTimePattern-count-other": "{0} min. ago" + } + }, + "minute-narrow": { + "displayName": "min.", + "relative-type-0": "this minute", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} min.", + "relativeTimePattern-count-other": "in {0} min." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} min. ago", + "relativeTimePattern-count-other": "{0} min. ago" + } + }, + "second": { + "displayName": "second", + "relative-type-0": "now", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} second", + "relativeTimePattern-count-other": "in {0} seconds" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} second ago", + "relativeTimePattern-count-other": "{0} seconds ago" + } + }, + "second-short": { + "displayName": "sec.", + "relative-type-0": "now", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} sec.", + "relativeTimePattern-count-other": "in {0} sec." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} sec. ago", + "relativeTimePattern-count-other": "{0} sec. ago" + } + }, + "second-narrow": { + "displayName": "sec.", + "relative-type-0": "now", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "in {0} sec.", + "relativeTimePattern-count-other": "in {0} sec." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} sec. ago", + "relativeTimePattern-count-other": "{0} sec. ago" + } + }, + "zone": { + "displayName": "time zone" + }, + "zone-short": { + "displayName": "zone" + }, + "zone-narrow": { + "displayName": "zone" + } + } + } + } + } +} diff --git a/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/timeZoneNames.json b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/timeZoneNames.json new file mode 100755 index 00000000000..5706c052422 --- /dev/null +++ b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/en/timeZoneNames.json @@ -0,0 +1,2359 @@ +{ + "main": { + "en": { + "identity": { + "version": { + "_cldrVersion": "37" + }, + "language": "en" + }, + "dates": { + "timeZoneNames": { + "hourFormat": "+HH:mm;-HH:mm", + "gmtFormat": "GMT{0}", + "gmtZeroFormat": "GMT", + "regionFormat": "{0} Time", + "regionFormat-type-daylight": "{0} Daylight Time", + "regionFormat-type-standard": "{0} Standard Time", + "fallbackFormat": "{1} ({0})", + "zone": { + "America": { + "Adak": { + "exemplarCity": "Adak" + }, + "Anchorage": { + "exemplarCity": "Anchorage" + }, + "Anguilla": { + "exemplarCity": "Anguilla" + }, + "Antigua": { + "exemplarCity": "Antigua" + }, + "Araguaina": { + "exemplarCity": "Araguaina" + }, + "Argentina": { + "Rio_Gallegos": { + "exemplarCity": "Rio Gallegos" + }, + "San_Juan": { + "exemplarCity": "San Juan" + }, + "Ushuaia": { + "exemplarCity": "Ushuaia" + }, + "La_Rioja": { + "exemplarCity": "La Rioja" + }, + "San_Luis": { + "exemplarCity": "San Luis" + }, + "Salta": { + "exemplarCity": "Salta" + }, + "Tucuman": { + "exemplarCity": "Tucuman" + } + }, + "Aruba": { + "exemplarCity": "Aruba" + }, + "Asuncion": { + "exemplarCity": "Asunción" + }, + "Bahia": { + "exemplarCity": "Bahia" + }, + "Bahia_Banderas": { + "exemplarCity": "Bahia Banderas" + }, + "Barbados": { + "exemplarCity": "Barbados" + }, + "Belem": { + "exemplarCity": "Belem" + }, + "Belize": { + "exemplarCity": "Belize" + }, + "Blanc-Sablon": { + "exemplarCity": "Blanc-Sablon" + }, + "Boa_Vista": { + "exemplarCity": "Boa Vista" + }, + "Bogota": { + "exemplarCity": "Bogota" + }, + "Boise": { + "exemplarCity": "Boise" + }, + "Buenos_Aires": { + "exemplarCity": "Buenos Aires" + }, + "Cambridge_Bay": { + "exemplarCity": "Cambridge Bay" + }, + "Campo_Grande": { + "exemplarCity": "Campo Grande" + }, + "Cancun": { + "exemplarCity": "Cancun" + }, + "Caracas": { + "exemplarCity": "Caracas" + }, + "Catamarca": { + "exemplarCity": "Catamarca" + }, + "Cayenne": { + "exemplarCity": "Cayenne" + }, + "Cayman": { + "exemplarCity": "Cayman" + }, + "Chicago": { + "exemplarCity": "Chicago" + }, + "Chihuahua": { + "exemplarCity": "Chihuahua" + }, + "Coral_Harbour": { + "exemplarCity": "Atikokan" + }, + "Cordoba": { + "exemplarCity": "Cordoba" + }, + "Costa_Rica": { + "exemplarCity": "Costa Rica" + }, + "Creston": { + "exemplarCity": "Creston" + }, + "Cuiaba": { + "exemplarCity": "Cuiaba" + }, + "Curacao": { + "exemplarCity": "Curaçao" + }, + "Danmarkshavn": { + "exemplarCity": "Danmarkshavn" + }, + "Dawson": { + "exemplarCity": "Dawson" + }, + "Dawson_Creek": { + "exemplarCity": "Dawson Creek" + }, + "Denver": { + "exemplarCity": "Denver" + }, + "Detroit": { + "exemplarCity": "Detroit" + }, + "Dominica": { + "exemplarCity": "Dominica" + }, + "Edmonton": { + "exemplarCity": "Edmonton" + }, + "Eirunepe": { + "exemplarCity": "Eirunepe" + }, + "El_Salvador": { + "exemplarCity": "El Salvador" + }, + "Fort_Nelson": { + "exemplarCity": "Fort Nelson" + }, + "Fortaleza": { + "exemplarCity": "Fortaleza" + }, + "Glace_Bay": { + "exemplarCity": "Glace Bay" + }, + "Godthab": { + "exemplarCity": "Nuuk" + }, + "Goose_Bay": { + "exemplarCity": "Goose Bay" + }, + "Grand_Turk": { + "exemplarCity": "Grand Turk" + }, + "Grenada": { + "exemplarCity": "Grenada" + }, + "Guadeloupe": { + "exemplarCity": "Guadeloupe" + }, + "Guatemala": { + "exemplarCity": "Guatemala" + }, + "Guayaquil": { + "exemplarCity": "Guayaquil" + }, + "Guyana": { + "exemplarCity": "Guyana" + }, + "Halifax": { + "exemplarCity": "Halifax" + }, + "Havana": { + "exemplarCity": "Havana" + }, + "Hermosillo": { + "exemplarCity": "Hermosillo" + }, + "Indiana": { + "Vincennes": { + "exemplarCity": "Vincennes, Indiana" + }, + "Petersburg": { + "exemplarCity": "Petersburg, Indiana" + }, + "Tell_City": { + "exemplarCity": "Tell City, Indiana" + }, + "Knox": { + "exemplarCity": "Knox, Indiana" + }, + "Winamac": { + "exemplarCity": "Winamac, Indiana" + }, + "Marengo": { + "exemplarCity": "Marengo, Indiana" + }, + "Vevay": { + "exemplarCity": "Vevay, Indiana" + } + }, + "Indianapolis": { + "exemplarCity": "Indianapolis" + }, + "Inuvik": { + "exemplarCity": "Inuvik" + }, + "Iqaluit": { + "exemplarCity": "Iqaluit" + }, + "Jamaica": { + "exemplarCity": "Jamaica" + }, + "Jujuy": { + "exemplarCity": "Jujuy" + }, + "Juneau": { + "exemplarCity": "Juneau" + }, + "Kentucky": { + "Monticello": { + "exemplarCity": "Monticello, Kentucky" + } + }, + "Kralendijk": { + "exemplarCity": "Kralendijk" + }, + "La_Paz": { + "exemplarCity": "La Paz" + }, + "Lima": { + "exemplarCity": "Lima" + }, + "Los_Angeles": { + "exemplarCity": "Los Angeles" + }, + "Louisville": { + "exemplarCity": "Louisville" + }, + "Lower_Princes": { + "exemplarCity": "Lower Prince’s Quarter" + }, + "Maceio": { + "exemplarCity": "Maceio" + }, + "Managua": { + "exemplarCity": "Managua" + }, + "Manaus": { + "exemplarCity": "Manaus" + }, + "Marigot": { + "exemplarCity": "Marigot" + }, + "Martinique": { + "exemplarCity": "Martinique" + }, + "Matamoros": { + "exemplarCity": "Matamoros" + }, + "Mazatlan": { + "exemplarCity": "Mazatlan" + }, + "Mendoza": { + "exemplarCity": "Mendoza" + }, + "Menominee": { + "exemplarCity": "Menominee" + }, + "Merida": { + "exemplarCity": "Merida" + }, + "Metlakatla": { + "exemplarCity": "Metlakatla" + }, + "Mexico_City": { + "exemplarCity": "Mexico City" + }, + "Miquelon": { + "exemplarCity": "Miquelon" + }, + "Moncton": { + "exemplarCity": "Moncton" + }, + "Monterrey": { + "exemplarCity": "Monterrey" + }, + "Montevideo": { + "exemplarCity": "Montevideo" + }, + "Montserrat": { + "exemplarCity": "Montserrat" + }, + "Nassau": { + "exemplarCity": "Nassau" + }, + "New_York": { + "exemplarCity": "New York" + }, + "Nipigon": { + "exemplarCity": "Nipigon" + }, + "Nome": { + "exemplarCity": "Nome" + }, + "Noronha": { + "exemplarCity": "Noronha" + }, + "North_Dakota": { + "Beulah": { + "exemplarCity": "Beulah, North Dakota" + }, + "New_Salem": { + "exemplarCity": "New Salem, North Dakota" + }, + "Center": { + "exemplarCity": "Center, North Dakota" + } + }, + "Ojinaga": { + "exemplarCity": "Ojinaga" + }, + "Panama": { + "exemplarCity": "Panama" + }, + "Pangnirtung": { + "exemplarCity": "Pangnirtung" + }, + "Paramaribo": { + "exemplarCity": "Paramaribo" + }, + "Phoenix": { + "exemplarCity": "Phoenix" + }, + "Port-au-Prince": { + "exemplarCity": "Port-au-Prince" + }, + "Port_of_Spain": { + "exemplarCity": "Port of Spain" + }, + "Porto_Velho": { + "exemplarCity": "Porto Velho" + }, + "Puerto_Rico": { + "exemplarCity": "Puerto Rico" + }, + "Punta_Arenas": { + "exemplarCity": "Punta Arenas" + }, + "Rainy_River": { + "exemplarCity": "Rainy River" + }, + "Rankin_Inlet": { + "exemplarCity": "Rankin Inlet" + }, + "Recife": { + "exemplarCity": "Recife" + }, + "Regina": { + "exemplarCity": "Regina" + }, + "Resolute": { + "exemplarCity": "Resolute" + }, + "Rio_Branco": { + "exemplarCity": "Rio Branco" + }, + "Santarem": { + "exemplarCity": "Santarem" + }, + "Santiago": { + "exemplarCity": "Santiago" + }, + "Santo_Domingo": { + "exemplarCity": "Santo Domingo" + }, + "Sao_Paulo": { + "exemplarCity": "Sao Paulo" + }, + "Scoresbysund": { + "exemplarCity": "Ittoqqortoormiit" + }, + "Sitka": { + "exemplarCity": "Sitka" + }, + "St_Barthelemy": { + "exemplarCity": "St. Barthélemy" + }, + "St_Johns": { + "exemplarCity": "St. John’s" + }, + "St_Kitts": { + "exemplarCity": "St. Kitts" + }, + "St_Lucia": { + "exemplarCity": "St. Lucia" + }, + "St_Thomas": { + "exemplarCity": "St. Thomas" + }, + "St_Vincent": { + "exemplarCity": "St. Vincent" + }, + "Swift_Current": { + "exemplarCity": "Swift Current" + }, + "Tegucigalpa": { + "exemplarCity": "Tegucigalpa" + }, + "Thule": { + "exemplarCity": "Thule" + }, + "Thunder_Bay": { + "exemplarCity": "Thunder Bay" + }, + "Tijuana": { + "exemplarCity": "Tijuana" + }, + "Toronto": { + "exemplarCity": "Toronto" + }, + "Tortola": { + "exemplarCity": "Tortola" + }, + "Vancouver": { + "exemplarCity": "Vancouver" + }, + "Whitehorse": { + "exemplarCity": "Whitehorse" + }, + "Winnipeg": { + "exemplarCity": "Winnipeg" + }, + "Yakutat": { + "exemplarCity": "Yakutat" + }, + "Yellowknife": { + "exemplarCity": "Yellowknife" + } + }, + "Atlantic": { + "Azores": { + "exemplarCity": "Azores" + }, + "Bermuda": { + "exemplarCity": "Bermuda" + }, + "Canary": { + "exemplarCity": "Canary" + }, + "Cape_Verde": { + "exemplarCity": "Cape Verde" + }, + "Faeroe": { + "exemplarCity": "Faroe" + }, + "Madeira": { + "exemplarCity": "Madeira" + }, + "Reykjavik": { + "exemplarCity": "Reykjavik" + }, + "South_Georgia": { + "exemplarCity": "South Georgia" + }, + "St_Helena": { + "exemplarCity": "St. Helena" + }, + "Stanley": { + "exemplarCity": "Stanley" + } + }, + "Europe": { + "Amsterdam": { + "exemplarCity": "Amsterdam" + }, + "Andorra": { + "exemplarCity": "Andorra" + }, + "Astrakhan": { + "exemplarCity": "Astrakhan" + }, + "Athens": { + "exemplarCity": "Athens" + }, + "Belgrade": { + "exemplarCity": "Belgrade" + }, + "Berlin": { + "exemplarCity": "Berlin" + }, + "Bratislava": { + "exemplarCity": "Bratislava" + }, + "Brussels": { + "exemplarCity": "Brussels" + }, + "Bucharest": { + "exemplarCity": "Bucharest" + }, + "Budapest": { + "exemplarCity": "Budapest" + }, + "Busingen": { + "exemplarCity": "Busingen" + }, + "Chisinau": { + "exemplarCity": "Chisinau" + }, + "Copenhagen": { + "exemplarCity": "Copenhagen" + }, + "Dublin": { + "long": { + "daylight": "Irish Standard Time" + }, + "exemplarCity": "Dublin" + }, + "Gibraltar": { + "exemplarCity": "Gibraltar" + }, + "Guernsey": { + "exemplarCity": "Guernsey" + }, + "Helsinki": { + "exemplarCity": "Helsinki" + }, + "Isle_of_Man": { + "exemplarCity": "Isle of Man" + }, + "Istanbul": { + "exemplarCity": "Istanbul" + }, + "Jersey": { + "exemplarCity": "Jersey" + }, + "Kaliningrad": { + "exemplarCity": "Kaliningrad" + }, + "Kiev": { + "exemplarCity": "Kiev", + "exemplarCity-alt-formal": "Kyiv" + }, + "Kirov": { + "exemplarCity": "Kirov" + }, + "Lisbon": { + "exemplarCity": "Lisbon" + }, + "Ljubljana": { + "exemplarCity": "Ljubljana" + }, + "London": { + "long": { + "daylight": "British Summer Time" + }, + "exemplarCity": "London" + }, + "Luxembourg": { + "exemplarCity": "Luxembourg" + }, + "Madrid": { + "exemplarCity": "Madrid" + }, + "Malta": { + "exemplarCity": "Malta" + }, + "Mariehamn": { + "exemplarCity": "Mariehamn" + }, + "Minsk": { + "exemplarCity": "Minsk" + }, + "Monaco": { + "exemplarCity": "Monaco" + }, + "Moscow": { + "exemplarCity": "Moscow" + }, + "Oslo": { + "exemplarCity": "Oslo" + }, + "Paris": { + "exemplarCity": "Paris" + }, + "Podgorica": { + "exemplarCity": "Podgorica" + }, + "Prague": { + "exemplarCity": "Prague" + }, + "Riga": { + "exemplarCity": "Riga" + }, + "Rome": { + "exemplarCity": "Rome" + }, + "Samara": { + "exemplarCity": "Samara" + }, + "San_Marino": { + "exemplarCity": "San Marino" + }, + "Sarajevo": { + "exemplarCity": "Sarajevo" + }, + "Saratov": { + "exemplarCity": "Saratov" + }, + "Simferopol": { + "exemplarCity": "Simferopol" + }, + "Skopje": { + "exemplarCity": "Skopje" + }, + "Sofia": { + "exemplarCity": "Sofia" + }, + "Stockholm": { + "exemplarCity": "Stockholm" + }, + "Tallinn": { + "exemplarCity": "Tallinn" + }, + "Tirane": { + "exemplarCity": "Tirane" + }, + "Ulyanovsk": { + "exemplarCity": "Ulyanovsk" + }, + "Uzhgorod": { + "exemplarCity": "Uzhhorod" + }, + "Vaduz": { + "exemplarCity": "Vaduz" + }, + "Vatican": { + "exemplarCity": "Vatican" + }, + "Vienna": { + "exemplarCity": "Vienna" + }, + "Vilnius": { + "exemplarCity": "Vilnius" + }, + "Volgograd": { + "exemplarCity": "Volgograd" + }, + "Warsaw": { + "exemplarCity": "Warsaw" + }, + "Zagreb": { + "exemplarCity": "Zagreb" + }, + "Zaporozhye": { + "exemplarCity": "Zaporozhye" + }, + "Zurich": { + "exemplarCity": "Zurich" + } + }, + "Africa": { + "Abidjan": { + "exemplarCity": "Abidjan" + }, + "Accra": { + "exemplarCity": "Accra" + }, + "Addis_Ababa": { + "exemplarCity": "Addis Ababa" + }, + "Algiers": { + "exemplarCity": "Algiers" + }, + "Asmera": { + "exemplarCity": "Asmara" + }, + "Bamako": { + "exemplarCity": "Bamako" + }, + "Bangui": { + "exemplarCity": "Bangui" + }, + "Banjul": { + "exemplarCity": "Banjul" + }, + "Bissau": { + "exemplarCity": "Bissau" + }, + "Blantyre": { + "exemplarCity": "Blantyre" + }, + "Brazzaville": { + "exemplarCity": "Brazzaville" + }, + "Bujumbura": { + "exemplarCity": "Bujumbura" + }, + "Cairo": { + "exemplarCity": "Cairo" + }, + "Casablanca": { + "exemplarCity": "Casablanca" + }, + "Ceuta": { + "exemplarCity": "Ceuta" + }, + "Conakry": { + "exemplarCity": "Conakry" + }, + "Dakar": { + "exemplarCity": "Dakar" + }, + "Dar_es_Salaam": { + "exemplarCity": "Dar es Salaam" + }, + "Djibouti": { + "exemplarCity": "Djibouti" + }, + "Douala": { + "exemplarCity": "Douala" + }, + "El_Aaiun": { + "exemplarCity": "El Aaiun" + }, + "Freetown": { + "exemplarCity": "Freetown" + }, + "Gaborone": { + "exemplarCity": "Gaborone" + }, + "Harare": { + "exemplarCity": "Harare" + }, + "Johannesburg": { + "exemplarCity": "Johannesburg" + }, + "Juba": { + "exemplarCity": "Juba" + }, + "Kampala": { + "exemplarCity": "Kampala" + }, + "Khartoum": { + "exemplarCity": "Khartoum" + }, + "Kigali": { + "exemplarCity": "Kigali" + }, + "Kinshasa": { + "exemplarCity": "Kinshasa" + }, + "Lagos": { + "exemplarCity": "Lagos" + }, + "Libreville": { + "exemplarCity": "Libreville" + }, + "Lome": { + "exemplarCity": "Lome" + }, + "Luanda": { + "exemplarCity": "Luanda" + }, + "Lubumbashi": { + "exemplarCity": "Lubumbashi" + }, + "Lusaka": { + "exemplarCity": "Lusaka" + }, + "Malabo": { + "exemplarCity": "Malabo" + }, + "Maputo": { + "exemplarCity": "Maputo" + }, + "Maseru": { + "exemplarCity": "Maseru" + }, + "Mbabane": { + "exemplarCity": "Mbabane" + }, + "Mogadishu": { + "exemplarCity": "Mogadishu" + }, + "Monrovia": { + "exemplarCity": "Monrovia" + }, + "Nairobi": { + "exemplarCity": "Nairobi" + }, + "Ndjamena": { + "exemplarCity": "Ndjamena" + }, + "Niamey": { + "exemplarCity": "Niamey" + }, + "Nouakchott": { + "exemplarCity": "Nouakchott" + }, + "Ouagadougou": { + "exemplarCity": "Ouagadougou" + }, + "Porto-Novo": { + "exemplarCity": "Porto-Novo" + }, + "Sao_Tome": { + "exemplarCity": "São Tomé" + }, + "Tripoli": { + "exemplarCity": "Tripoli" + }, + "Tunis": { + "exemplarCity": "Tunis" + }, + "Windhoek": { + "exemplarCity": "Windhoek" + } + }, + "Asia": { + "Aden": { + "exemplarCity": "Aden" + }, + "Almaty": { + "exemplarCity": "Almaty" + }, + "Amman": { + "exemplarCity": "Amman" + }, + "Anadyr": { + "exemplarCity": "Anadyr" + }, + "Aqtau": { + "exemplarCity": "Aqtau" + }, + "Aqtobe": { + "exemplarCity": "Aqtobe" + }, + "Ashgabat": { + "exemplarCity": "Ashgabat" + }, + "Atyrau": { + "exemplarCity": "Atyrau" + }, + "Baghdad": { + "exemplarCity": "Baghdad" + }, + "Bahrain": { + "exemplarCity": "Bahrain" + }, + "Baku": { + "exemplarCity": "Baku" + }, + "Bangkok": { + "exemplarCity": "Bangkok" + }, + "Barnaul": { + "exemplarCity": "Barnaul" + }, + "Beirut": { + "exemplarCity": "Beirut" + }, + "Bishkek": { + "exemplarCity": "Bishkek" + }, + "Brunei": { + "exemplarCity": "Brunei" + }, + "Calcutta": { + "exemplarCity": "Kolkata" + }, + "Chita": { + "exemplarCity": "Chita" + }, + "Choibalsan": { + "exemplarCity": "Choibalsan" + }, + "Colombo": { + "exemplarCity": "Colombo" + }, + "Damascus": { + "exemplarCity": "Damascus" + }, + "Dhaka": { + "exemplarCity": "Dhaka" + }, + "Dili": { + "exemplarCity": "Dili" + }, + "Dubai": { + "exemplarCity": "Dubai" + }, + "Dushanbe": { + "exemplarCity": "Dushanbe" + }, + "Famagusta": { + "exemplarCity": "Famagusta" + }, + "Gaza": { + "exemplarCity": "Gaza" + }, + "Hebron": { + "exemplarCity": "Hebron" + }, + "Hong_Kong": { + "exemplarCity": "Hong Kong" + }, + "Hovd": { + "exemplarCity": "Hovd" + }, + "Irkutsk": { + "exemplarCity": "Irkutsk" + }, + "Jakarta": { + "exemplarCity": "Jakarta" + }, + "Jayapura": { + "exemplarCity": "Jayapura" + }, + "Jerusalem": { + "exemplarCity": "Jerusalem" + }, + "Kabul": { + "exemplarCity": "Kabul" + }, + "Kamchatka": { + "exemplarCity": "Kamchatka" + }, + "Karachi": { + "exemplarCity": "Karachi" + }, + "Katmandu": { + "exemplarCity": "Kathmandu" + }, + "Khandyga": { + "exemplarCity": "Khandyga" + }, + "Krasnoyarsk": { + "exemplarCity": "Krasnoyarsk" + }, + "Kuala_Lumpur": { + "exemplarCity": "Kuala Lumpur" + }, + "Kuching": { + "exemplarCity": "Kuching" + }, + "Kuwait": { + "exemplarCity": "Kuwait" + }, + "Macau": { + "exemplarCity": "Macao" + }, + "Magadan": { + "exemplarCity": "Magadan" + }, + "Makassar": { + "exemplarCity": "Makassar" + }, + "Manila": { + "exemplarCity": "Manila" + }, + "Muscat": { + "exemplarCity": "Muscat" + }, + "Nicosia": { + "exemplarCity": "Nicosia" + }, + "Novokuznetsk": { + "exemplarCity": "Novokuznetsk" + }, + "Novosibirsk": { + "exemplarCity": "Novosibirsk" + }, + "Omsk": { + "exemplarCity": "Omsk" + }, + "Oral": { + "exemplarCity": "Oral" + }, + "Phnom_Penh": { + "exemplarCity": "Phnom Penh" + }, + "Pontianak": { + "exemplarCity": "Pontianak" + }, + "Pyongyang": { + "exemplarCity": "Pyongyang" + }, + "Qatar": { + "exemplarCity": "Qatar" + }, + "Qostanay": { + "exemplarCity": "Kostanay" + }, + "Qyzylorda": { + "exemplarCity": "Qyzylorda" + }, + "Rangoon": { + "exemplarCity": "Yangon" + }, + "Riyadh": { + "exemplarCity": "Riyadh" + }, + "Saigon": { + "exemplarCity": "Ho Chi Minh City" + }, + "Sakhalin": { + "exemplarCity": "Sakhalin" + }, + "Samarkand": { + "exemplarCity": "Samarkand" + }, + "Seoul": { + "exemplarCity": "Seoul" + }, + "Shanghai": { + "exemplarCity": "Shanghai" + }, + "Singapore": { + "exemplarCity": "Singapore" + }, + "Srednekolymsk": { + "exemplarCity": "Srednekolymsk" + }, + "Taipei": { + "exemplarCity": "Taipei" + }, + "Tashkent": { + "exemplarCity": "Tashkent" + }, + "Tbilisi": { + "exemplarCity": "Tbilisi" + }, + "Tehran": { + "exemplarCity": "Tehran" + }, + "Thimphu": { + "exemplarCity": "Thimphu" + }, + "Tokyo": { + "exemplarCity": "Tokyo" + }, + "Tomsk": { + "exemplarCity": "Tomsk" + }, + "Ulaanbaatar": { + "exemplarCity": "Ulaanbaatar" + }, + "Urumqi": { + "exemplarCity": "Urumqi" + }, + "Ust-Nera": { + "exemplarCity": "Ust-Nera" + }, + "Vientiane": { + "exemplarCity": "Vientiane" + }, + "Vladivostok": { + "exemplarCity": "Vladivostok" + }, + "Yakutsk": { + "exemplarCity": "Yakutsk" + }, + "Yekaterinburg": { + "exemplarCity": "Yekaterinburg" + }, + "Yerevan": { + "exemplarCity": "Yerevan" + } + }, + "Indian": { + "Antananarivo": { + "exemplarCity": "Antananarivo" + }, + "Chagos": { + "exemplarCity": "Chagos" + }, + "Christmas": { + "exemplarCity": "Christmas" + }, + "Cocos": { + "exemplarCity": "Cocos" + }, + "Comoro": { + "exemplarCity": "Comoro" + }, + "Kerguelen": { + "exemplarCity": "Kerguelen" + }, + "Mahe": { + "exemplarCity": "Mahe" + }, + "Maldives": { + "exemplarCity": "Maldives" + }, + "Mauritius": { + "exemplarCity": "Mauritius" + }, + "Mayotte": { + "exemplarCity": "Mayotte" + }, + "Reunion": { + "exemplarCity": "Réunion" + } + }, + "Australia": { + "Adelaide": { + "exemplarCity": "Adelaide" + }, + "Brisbane": { + "exemplarCity": "Brisbane" + }, + "Broken_Hill": { + "exemplarCity": "Broken Hill" + }, + "Currie": { + "exemplarCity": "Currie" + }, + "Darwin": { + "exemplarCity": "Darwin" + }, + "Eucla": { + "exemplarCity": "Eucla" + }, + "Hobart": { + "exemplarCity": "Hobart" + }, + "Lindeman": { + "exemplarCity": "Lindeman" + }, + "Lord_Howe": { + "exemplarCity": "Lord Howe" + }, + "Melbourne": { + "exemplarCity": "Melbourne" + }, + "Perth": { + "exemplarCity": "Perth" + }, + "Sydney": { + "exemplarCity": "Sydney" + } + }, + "Pacific": { + "Apia": { + "exemplarCity": "Apia" + }, + "Auckland": { + "exemplarCity": "Auckland" + }, + "Bougainville": { + "exemplarCity": "Bougainville" + }, + "Chatham": { + "exemplarCity": "Chatham" + }, + "Easter": { + "exemplarCity": "Easter" + }, + "Efate": { + "exemplarCity": "Efate" + }, + "Enderbury": { + "exemplarCity": "Enderbury" + }, + "Fakaofo": { + "exemplarCity": "Fakaofo" + }, + "Fiji": { + "exemplarCity": "Fiji" + }, + "Funafuti": { + "exemplarCity": "Funafuti" + }, + "Galapagos": { + "exemplarCity": "Galapagos" + }, + "Gambier": { + "exemplarCity": "Gambier" + }, + "Guadalcanal": { + "exemplarCity": "Guadalcanal" + }, + "Guam": { + "exemplarCity": "Guam" + }, + "Honolulu": { + "short": { + "generic": "HST", + "standard": "HST", + "daylight": "HDT" + } + }, + "Johnston": { + "exemplarCity": "Johnston" + }, + "Kiritimati": { + "exemplarCity": "Kiritimati" + }, + "Kosrae": { + "exemplarCity": "Kosrae" + }, + "Kwajalein": { + "exemplarCity": "Kwajalein" + }, + "Majuro": { + "exemplarCity": "Majuro" + }, + "Marquesas": { + "exemplarCity": "Marquesas" + }, + "Midway": { + "exemplarCity": "Midway" + }, + "Nauru": { + "exemplarCity": "Nauru" + }, + "Niue": { + "exemplarCity": "Niue" + }, + "Norfolk": { + "exemplarCity": "Norfolk" + }, + "Noumea": { + "exemplarCity": "Noumea" + }, + "Pago_Pago": { + "exemplarCity": "Pago Pago" + }, + "Palau": { + "exemplarCity": "Palau" + }, + "Pitcairn": { + "exemplarCity": "Pitcairn" + }, + "Ponape": { + "exemplarCity": "Pohnpei" + }, + "Port_Moresby": { + "exemplarCity": "Port Moresby" + }, + "Rarotonga": { + "exemplarCity": "Rarotonga" + }, + "Saipan": { + "exemplarCity": "Saipan" + }, + "Tahiti": { + "exemplarCity": "Tahiti" + }, + "Tarawa": { + "exemplarCity": "Tarawa" + }, + "Tongatapu": { + "exemplarCity": "Tongatapu" + }, + "Truk": { + "exemplarCity": "Chuuk" + }, + "Wake": { + "exemplarCity": "Wake" + }, + "Wallis": { + "exemplarCity": "Wallis" + } + }, + "Arctic": { + "Longyearbyen": { + "exemplarCity": "Longyearbyen" + } + }, + "Antarctica": { + "Casey": { + "exemplarCity": "Casey" + }, + "Davis": { + "exemplarCity": "Davis" + }, + "DumontDUrville": { + "exemplarCity": "Dumont d’Urville" + }, + "Macquarie": { + "exemplarCity": "Macquarie" + }, + "Mawson": { + "exemplarCity": "Mawson" + }, + "McMurdo": { + "exemplarCity": "McMurdo" + }, + "Palmer": { + "exemplarCity": "Palmer" + }, + "Rothera": { + "exemplarCity": "Rothera" + }, + "Syowa": { + "exemplarCity": "Syowa" + }, + "Troll": { + "exemplarCity": "Troll" + }, + "Vostok": { + "exemplarCity": "Vostok" + } + }, + "Etc": { + "UTC": { + "long": { + "standard": "Coordinated Universal Time" + }, + "short": { + "standard": "UTC" + } + }, + "Unknown": { + "exemplarCity": "Unknown City" + } + } + }, + "metazone": { + "Acre": { + "long": { + "generic": "Acre Time", + "standard": "Acre Standard Time", + "daylight": "Acre Summer Time" + } + }, + "Afghanistan": { + "long": { + "standard": "Afghanistan Time" + } + }, + "Africa_Central": { + "long": { + "standard": "Central Africa Time" + } + }, + "Africa_Eastern": { + "long": { + "standard": "East Africa Time" + } + }, + "Africa_Southern": { + "long": { + "standard": "South Africa Standard Time" + } + }, + "Africa_Western": { + "long": { + "generic": "West Africa Time", + "standard": "West Africa Standard Time", + "daylight": "West Africa Summer Time" + } + }, + "Alaska": { + "long": { + "generic": "Alaska Time", + "standard": "Alaska Standard Time", + "daylight": "Alaska Daylight Time" + }, + "short": { + "generic": "AKT", + "standard": "AKST", + "daylight": "AKDT" + } + }, + "Almaty": { + "long": { + "generic": "Almaty Time", + "standard": "Almaty Standard Time", + "daylight": "Almaty Summer Time" + } + }, + "Amazon": { + "long": { + "generic": "Amazon Time", + "standard": "Amazon Standard Time", + "daylight": "Amazon Summer Time" + } + }, + "America_Central": { + "long": { + "generic": "Central Time", + "standard": "Central Standard Time", + "daylight": "Central Daylight Time" + }, + "short": { + "generic": "CT", + "standard": "CST", + "daylight": "CDT" + } + }, + "America_Eastern": { + "long": { + "generic": "Eastern Time", + "standard": "Eastern Standard Time", + "daylight": "Eastern Daylight Time" + }, + "short": { + "generic": "ET", + "standard": "EST", + "daylight": "EDT" + } + }, + "America_Mountain": { + "long": { + "generic": "Mountain Time", + "standard": "Mountain Standard Time", + "daylight": "Mountain Daylight Time" + }, + "short": { + "generic": "MT", + "standard": "MST", + "daylight": "MDT" + } + }, + "America_Pacific": { + "long": { + "generic": "Pacific Time", + "standard": "Pacific Standard Time", + "daylight": "Pacific Daylight Time" + }, + "short": { + "generic": "PT", + "standard": "PST", + "daylight": "PDT" + } + }, + "Anadyr": { + "long": { + "generic": "Anadyr Time", + "standard": "Anadyr Standard Time", + "daylight": "Anadyr Summer Time" + } + }, + "Apia": { + "long": { + "generic": "Apia Time", + "standard": "Apia Standard Time", + "daylight": "Apia Daylight Time" + } + }, + "Aqtau": { + "long": { + "generic": "Aqtau Time", + "standard": "Aqtau Standard Time", + "daylight": "Aqtau Summer Time" + } + }, + "Aqtobe": { + "long": { + "generic": "Aqtobe Time", + "standard": "Aqtobe Standard Time", + "daylight": "Aqtobe Summer Time" + } + }, + "Arabian": { + "long": { + "generic": "Arabian Time", + "standard": "Arabian Standard Time", + "daylight": "Arabian Daylight Time" + } + }, + "Argentina": { + "long": { + "generic": "Argentina Time", + "standard": "Argentina Standard Time", + "daylight": "Argentina Summer Time" + } + }, + "Argentina_Western": { + "long": { + "generic": "Western Argentina Time", + "standard": "Western Argentina Standard Time", + "daylight": "Western Argentina Summer Time" + } + }, + "Armenia": { + "long": { + "generic": "Armenia Time", + "standard": "Armenia Standard Time", + "daylight": "Armenia Summer Time" + } + }, + "Atlantic": { + "long": { + "generic": "Atlantic Time", + "standard": "Atlantic Standard Time", + "daylight": "Atlantic Daylight Time" + }, + "short": { + "generic": "AT", + "standard": "AST", + "daylight": "ADT" + } + }, + "Australia_Central": { + "long": { + "generic": "Central Australia Time", + "standard": "Australian Central Standard Time", + "daylight": "Australian Central Daylight Time" + } + }, + "Australia_CentralWestern": { + "long": { + "generic": "Australian Central Western Time", + "standard": "Australian Central Western Standard Time", + "daylight": "Australian Central Western Daylight Time" + } + }, + "Australia_Eastern": { + "long": { + "generic": "Eastern Australia Time", + "standard": "Australian Eastern Standard Time", + "daylight": "Australian Eastern Daylight Time" + } + }, + "Australia_Western": { + "long": { + "generic": "Western Australia Time", + "standard": "Australian Western Standard Time", + "daylight": "Australian Western Daylight Time" + } + }, + "Azerbaijan": { + "long": { + "generic": "Azerbaijan Time", + "standard": "Azerbaijan Standard Time", + "daylight": "Azerbaijan Summer Time" + } + }, + "Azores": { + "long": { + "generic": "Azores Time", + "standard": "Azores Standard Time", + "daylight": "Azores Summer Time" + } + }, + "Bangladesh": { + "long": { + "generic": "Bangladesh Time", + "standard": "Bangladesh Standard Time", + "daylight": "Bangladesh Summer Time" + } + }, + "Bhutan": { + "long": { + "standard": "Bhutan Time" + } + }, + "Bolivia": { + "long": { + "standard": "Bolivia Time" + } + }, + "Brasilia": { + "long": { + "generic": "Brasilia Time", + "standard": "Brasilia Standard Time", + "daylight": "Brasilia Summer Time" + } + }, + "Brunei": { + "long": { + "standard": "Brunei Darussalam Time" + } + }, + "Cape_Verde": { + "long": { + "generic": "Cape Verde Time", + "standard": "Cape Verde Standard Time", + "daylight": "Cape Verde Summer Time" + } + }, + "Casey": { + "long": { + "standard": "Casey Time" + } + }, + "Chamorro": { + "long": { + "standard": "Chamorro Standard Time" + } + }, + "Chatham": { + "long": { + "generic": "Chatham Time", + "standard": "Chatham Standard Time", + "daylight": "Chatham Daylight Time" + } + }, + "Chile": { + "long": { + "generic": "Chile Time", + "standard": "Chile Standard Time", + "daylight": "Chile Summer Time" + } + }, + "China": { + "long": { + "generic": "China Time", + "standard": "China Standard Time", + "daylight": "China Daylight Time" + } + }, + "Choibalsan": { + "long": { + "generic": "Choibalsan Time", + "standard": "Choibalsan Standard Time", + "daylight": "Choibalsan Summer Time" + } + }, + "Christmas": { + "long": { + "standard": "Christmas Island Time" + } + }, + "Cocos": { + "long": { + "standard": "Cocos Islands Time" + } + }, + "Colombia": { + "long": { + "generic": "Colombia Time", + "standard": "Colombia Standard Time", + "daylight": "Colombia Summer Time" + } + }, + "Cook": { + "long": { + "generic": "Cook Islands Time", + "standard": "Cook Islands Standard Time", + "daylight": "Cook Islands Half Summer Time" + } + }, + "Cuba": { + "long": { + "generic": "Cuba Time", + "standard": "Cuba Standard Time", + "daylight": "Cuba Daylight Time" + } + }, + "Davis": { + "long": { + "standard": "Davis Time" + } + }, + "DumontDUrville": { + "long": { + "standard": "Dumont-d’Urville Time" + } + }, + "East_Timor": { + "long": { + "standard": "East Timor Time" + } + }, + "Easter": { + "long": { + "generic": "Easter Island Time", + "standard": "Easter Island Standard Time", + "daylight": "Easter Island Summer Time" + } + }, + "Ecuador": { + "long": { + "standard": "Ecuador Time" + } + }, + "Europe_Central": { + "long": { + "generic": "Central European Time", + "standard": "Central European Standard Time", + "daylight": "Central European Summer Time" + } + }, + "Europe_Eastern": { + "long": { + "generic": "Eastern European Time", + "standard": "Eastern European Standard Time", + "daylight": "Eastern European Summer Time" + } + }, + "Europe_Further_Eastern": { + "long": { + "standard": "Further-eastern European Time" + } + }, + "Europe_Western": { + "long": { + "generic": "Western European Time", + "standard": "Western European Standard Time", + "daylight": "Western European Summer Time" + } + }, + "Falkland": { + "long": { + "generic": "Falkland Islands Time", + "standard": "Falkland Islands Standard Time", + "daylight": "Falkland Islands Summer Time" + } + }, + "Fiji": { + "long": { + "generic": "Fiji Time", + "standard": "Fiji Standard Time", + "daylight": "Fiji Summer Time" + } + }, + "French_Guiana": { + "long": { + "standard": "French Guiana Time" + } + }, + "French_Southern": { + "long": { + "standard": "French Southern & Antarctic Time" + } + }, + "Galapagos": { + "long": { + "standard": "Galapagos Time" + } + }, + "Gambier": { + "long": { + "standard": "Gambier Time" + } + }, + "Georgia": { + "long": { + "generic": "Georgia Time", + "standard": "Georgia Standard Time", + "daylight": "Georgia Summer Time" + } + }, + "Gilbert_Islands": { + "long": { + "standard": "Gilbert Islands Time" + } + }, + "GMT": { + "long": { + "standard": "Greenwich Mean Time" + }, + "short": { + "standard": "GMT" + } + }, + "Greenland_Eastern": { + "long": { + "generic": "East Greenland Time", + "standard": "East Greenland Standard Time", + "daylight": "East Greenland Summer Time" + } + }, + "Greenland_Western": { + "long": { + "generic": "West Greenland Time", + "standard": "West Greenland Standard Time", + "daylight": "West Greenland Summer Time" + } + }, + "Guam": { + "long": { + "standard": "Guam Standard Time" + } + }, + "Gulf": { + "long": { + "standard": "Gulf Standard Time" + } + }, + "Guyana": { + "long": { + "standard": "Guyana Time" + } + }, + "Hawaii_Aleutian": { + "long": { + "generic": "Hawaii-Aleutian Time", + "standard": "Hawaii-Aleutian Standard Time", + "daylight": "Hawaii-Aleutian Daylight Time" + }, + "short": { + "generic": "HAT", + "standard": "HAST", + "daylight": "HADT" + } + }, + "Hong_Kong": { + "long": { + "generic": "Hong Kong Time", + "standard": "Hong Kong Standard Time", + "daylight": "Hong Kong Summer Time" + } + }, + "Hovd": { + "long": { + "generic": "Hovd Time", + "standard": "Hovd Standard Time", + "daylight": "Hovd Summer Time" + } + }, + "India": { + "long": { + "standard": "India Standard Time" + } + }, + "Indian_Ocean": { + "long": { + "standard": "Indian Ocean Time" + } + }, + "Indochina": { + "long": { + "standard": "Indochina Time" + } + }, + "Indonesia_Central": { + "long": { + "standard": "Central Indonesia Time" + } + }, + "Indonesia_Eastern": { + "long": { + "standard": "Eastern Indonesia Time" + } + }, + "Indonesia_Western": { + "long": { + "standard": "Western Indonesia Time" + } + }, + "Iran": { + "long": { + "generic": "Iran Time", + "standard": "Iran Standard Time", + "daylight": "Iran Daylight Time" + } + }, + "Irkutsk": { + "long": { + "generic": "Irkutsk Time", + "standard": "Irkutsk Standard Time", + "daylight": "Irkutsk Summer Time" + } + }, + "Israel": { + "long": { + "generic": "Israel Time", + "standard": "Israel Standard Time", + "daylight": "Israel Daylight Time" + } + }, + "Japan": { + "long": { + "generic": "Japan Time", + "standard": "Japan Standard Time", + "daylight": "Japan Daylight Time" + } + }, + "Kamchatka": { + "long": { + "generic": "Petropavlovsk-Kamchatski Time", + "standard": "Petropavlovsk-Kamchatski Standard Time", + "daylight": "Petropavlovsk-Kamchatski Summer Time" + } + }, + "Kazakhstan_Eastern": { + "long": { + "standard": "East Kazakhstan Time" + } + }, + "Kazakhstan_Western": { + "long": { + "standard": "West Kazakhstan Time" + } + }, + "Korea": { + "long": { + "generic": "Korean Time", + "standard": "Korean Standard Time", + "daylight": "Korean Daylight Time" + } + }, + "Kosrae": { + "long": { + "standard": "Kosrae Time" + } + }, + "Krasnoyarsk": { + "long": { + "generic": "Krasnoyarsk Time", + "standard": "Krasnoyarsk Standard Time", + "daylight": "Krasnoyarsk Summer Time" + } + }, + "Kyrgystan": { + "long": { + "standard": "Kyrgyzstan Time" + } + }, + "Lanka": { + "long": { + "standard": "Lanka Time" + } + }, + "Line_Islands": { + "long": { + "standard": "Line Islands Time" + } + }, + "Lord_Howe": { + "long": { + "generic": "Lord Howe Time", + "standard": "Lord Howe Standard Time", + "daylight": "Lord Howe Daylight Time" + } + }, + "Macau": { + "long": { + "generic": "Macao Time", + "standard": "Macao Standard Time", + "daylight": "Macao Summer Time" + } + }, + "Macquarie": { + "long": { + "standard": "Macquarie Island Time" + } + }, + "Magadan": { + "long": { + "generic": "Magadan Time", + "standard": "Magadan Standard Time", + "daylight": "Magadan Summer Time" + } + }, + "Malaysia": { + "long": { + "standard": "Malaysia Time" + } + }, + "Maldives": { + "long": { + "standard": "Maldives Time" + } + }, + "Marquesas": { + "long": { + "standard": "Marquesas Time" + } + }, + "Marshall_Islands": { + "long": { + "standard": "Marshall Islands Time" + } + }, + "Mauritius": { + "long": { + "generic": "Mauritius Time", + "standard": "Mauritius Standard Time", + "daylight": "Mauritius Summer Time" + } + }, + "Mawson": { + "long": { + "standard": "Mawson Time" + } + }, + "Mexico_Northwest": { + "long": { + "generic": "Northwest Mexico Time", + "standard": "Northwest Mexico Standard Time", + "daylight": "Northwest Mexico Daylight Time" + } + }, + "Mexico_Pacific": { + "long": { + "generic": "Mexican Pacific Time", + "standard": "Mexican Pacific Standard Time", + "daylight": "Mexican Pacific Daylight Time" + } + }, + "Mongolia": { + "long": { + "generic": "Ulaanbaatar Time", + "standard": "Ulaanbaatar Standard Time", + "daylight": "Ulaanbaatar Summer Time" + } + }, + "Moscow": { + "long": { + "generic": "Moscow Time", + "standard": "Moscow Standard Time", + "daylight": "Moscow Summer Time" + } + }, + "Myanmar": { + "long": { + "standard": "Myanmar Time" + } + }, + "Nauru": { + "long": { + "standard": "Nauru Time" + } + }, + "Nepal": { + "long": { + "standard": "Nepal Time" + } + }, + "New_Caledonia": { + "long": { + "generic": "New Caledonia Time", + "standard": "New Caledonia Standard Time", + "daylight": "New Caledonia Summer Time" + } + }, + "New_Zealand": { + "long": { + "generic": "New Zealand Time", + "standard": "New Zealand Standard Time", + "daylight": "New Zealand Daylight Time" + } + }, + "Newfoundland": { + "long": { + "generic": "Newfoundland Time", + "standard": "Newfoundland Standard Time", + "daylight": "Newfoundland Daylight Time" + } + }, + "Niue": { + "long": { + "standard": "Niue Time" + } + }, + "Norfolk": { + "long": { + "generic": "Norfolk Island Time", + "standard": "Norfolk Island Standard Time", + "daylight": "Norfolk Island Daylight Time" + } + }, + "Noronha": { + "long": { + "generic": "Fernando de Noronha Time", + "standard": "Fernando de Noronha Standard Time", + "daylight": "Fernando de Noronha Summer Time" + } + }, + "North_Mariana": { + "long": { + "standard": "North Mariana Islands Time" + } + }, + "Novosibirsk": { + "long": { + "generic": "Novosibirsk Time", + "standard": "Novosibirsk Standard Time", + "daylight": "Novosibirsk Summer Time" + } + }, + "Omsk": { + "long": { + "generic": "Omsk Time", + "standard": "Omsk Standard Time", + "daylight": "Omsk Summer Time" + } + }, + "Pakistan": { + "long": { + "generic": "Pakistan Time", + "standard": "Pakistan Standard Time", + "daylight": "Pakistan Summer Time" + } + }, + "Palau": { + "long": { + "standard": "Palau Time" + } + }, + "Papua_New_Guinea": { + "long": { + "standard": "Papua New Guinea Time" + } + }, + "Paraguay": { + "long": { + "generic": "Paraguay Time", + "standard": "Paraguay Standard Time", + "daylight": "Paraguay Summer Time" + } + }, + "Peru": { + "long": { + "generic": "Peru Time", + "standard": "Peru Standard Time", + "daylight": "Peru Summer Time" + } + }, + "Philippines": { + "long": { + "generic": "Philippine Time", + "standard": "Philippine Standard Time", + "daylight": "Philippine Summer Time" + } + }, + "Phoenix_Islands": { + "long": { + "standard": "Phoenix Islands Time" + } + }, + "Pierre_Miquelon": { + "long": { + "generic": "St. Pierre & Miquelon Time", + "standard": "St. Pierre & Miquelon Standard Time", + "daylight": "St. Pierre & Miquelon Daylight Time" + } + }, + "Pitcairn": { + "long": { + "standard": "Pitcairn Time" + } + }, + "Ponape": { + "long": { + "standard": "Ponape Time" + } + }, + "Pyongyang": { + "long": { + "standard": "Pyongyang Time" + } + }, + "Qyzylorda": { + "long": { + "generic": "Qyzylorda Time", + "standard": "Qyzylorda Standard Time", + "daylight": "Qyzylorda Summer Time" + } + }, + "Reunion": { + "long": { + "standard": "Réunion Time" + } + }, + "Rothera": { + "long": { + "standard": "Rothera Time" + } + }, + "Sakhalin": { + "long": { + "generic": "Sakhalin Time", + "standard": "Sakhalin Standard Time", + "daylight": "Sakhalin Summer Time" + } + }, + "Samara": { + "long": { + "generic": "Samara Time", + "standard": "Samara Standard Time", + "daylight": "Samara Summer Time" + } + }, + "Samoa": { + "long": { + "generic": "Samoa Time", + "standard": "Samoa Standard Time", + "daylight": "Samoa Daylight Time" + } + }, + "Seychelles": { + "long": { + "standard": "Seychelles Time" + } + }, + "Singapore": { + "long": { + "standard": "Singapore Standard Time" + } + }, + "Solomon": { + "long": { + "standard": "Solomon Islands Time" + } + }, + "South_Georgia": { + "long": { + "standard": "South Georgia Time" + } + }, + "Suriname": { + "long": { + "standard": "Suriname Time" + } + }, + "Syowa": { + "long": { + "standard": "Syowa Time" + } + }, + "Tahiti": { + "long": { + "standard": "Tahiti Time" + } + }, + "Taipei": { + "long": { + "generic": "Taipei Time", + "standard": "Taipei Standard Time", + "daylight": "Taipei Daylight Time" + } + }, + "Tajikistan": { + "long": { + "standard": "Tajikistan Time" + } + }, + "Tokelau": { + "long": { + "standard": "Tokelau Time" + } + }, + "Tonga": { + "long": { + "generic": "Tonga Time", + "standard": "Tonga Standard Time", + "daylight": "Tonga Summer Time" + } + }, + "Truk": { + "long": { + "standard": "Chuuk Time" + } + }, + "Turkmenistan": { + "long": { + "generic": "Turkmenistan Time", + "standard": "Turkmenistan Standard Time", + "daylight": "Turkmenistan Summer Time" + } + }, + "Tuvalu": { + "long": { + "standard": "Tuvalu Time" + } + }, + "Uruguay": { + "long": { + "generic": "Uruguay Time", + "standard": "Uruguay Standard Time", + "daylight": "Uruguay Summer Time" + } + }, + "Uzbekistan": { + "long": { + "generic": "Uzbekistan Time", + "standard": "Uzbekistan Standard Time", + "daylight": "Uzbekistan Summer Time" + } + }, + "Vanuatu": { + "long": { + "generic": "Vanuatu Time", + "standard": "Vanuatu Standard Time", + "daylight": "Vanuatu Summer Time" + } + }, + "Venezuela": { + "long": { + "standard": "Venezuela Time" + } + }, + "Vladivostok": { + "long": { + "generic": "Vladivostok Time", + "standard": "Vladivostok Standard Time", + "daylight": "Vladivostok Summer Time" + } + }, + "Volgograd": { + "long": { + "generic": "Volgograd Time", + "standard": "Volgograd Standard Time", + "daylight": "Volgograd Summer Time" + } + }, + "Vostok": { + "long": { + "standard": "Vostok Time" + } + }, + "Wake": { + "long": { + "standard": "Wake Island Time" + } + }, + "Wallis": { + "long": { + "standard": "Wallis & Futuna Time" + } + }, + "Yakutsk": { + "long": { + "generic": "Yakutsk Time", + "standard": "Yakutsk Standard Time", + "daylight": "Yakutsk Summer Time" + } + }, + "Yekaterinburg": { + "long": { + "generic": "Yekaterinburg Time", + "standard": "Yekaterinburg Standard Time", + "daylight": "Yekaterinburg Summer Time" + } + } + } + } + } + } + } +} diff --git a/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/ca-generic.json b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/ca-generic.json new file mode 100755 index 00000000000..b1a25fd1a37 --- /dev/null +++ b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/ca-generic.json @@ -0,0 +1,532 @@ +{ + "main": { + "pl": { + "identity": { + "version": { + "_cldrVersion": "37" + }, + "language": "pl" + }, + "dates": { + "calendars": { + "generic": { + "months": { + "format": { + "abbreviated": { + "1": "M01", + "2": "M02", + "3": "M03", + "4": "M04", + "5": "M05", + "6": "M06", + "7": "M07", + "8": "M08", + "9": "M09", + "10": "M10", + "11": "M11", + "12": "M12" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "10": "10", + "11": "11", + "12": "12" + }, + "wide": { + "1": "M01", + "2": "M02", + "3": "M03", + "4": "M04", + "5": "M05", + "6": "M06", + "7": "M07", + "8": "M08", + "9": "M09", + "10": "M10", + "11": "M11", + "12": "M12" + } + }, + "stand-alone": { + "abbreviated": { + "1": "M01", + "2": "M02", + "3": "M03", + "4": "M04", + "5": "M05", + "6": "M06", + "7": "M07", + "8": "M08", + "9": "M09", + "10": "M10", + "11": "M11", + "12": "M12" + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "10": "10", + "11": "11", + "12": "12" + }, + "wide": { + "1": "M01", + "2": "M02", + "3": "M03", + "4": "M04", + "5": "M05", + "6": "M06", + "7": "M07", + "8": "M08", + "9": "M09", + "10": "M10", + "11": "M11", + "12": "M12" + } + } + }, + "days": { + "format": { + "abbreviated": { + "sun": "niedz.", + "mon": "pon.", + "tue": "wt.", + "wed": "śr.", + "thu": "czw.", + "fri": "pt.", + "sat": "sob." + }, + "narrow": { + "sun": "n", + "mon": "p", + "tue": "w", + "wed": "ś", + "thu": "c", + "fri": "p", + "sat": "s" + }, + "short": { + "sun": "nie", + "mon": "pon", + "tue": "wto", + "wed": "śro", + "thu": "czw", + "fri": "pią", + "sat": "sob" + }, + "wide": { + "sun": "niedziela", + "mon": "poniedziałek", + "tue": "wtorek", + "wed": "środa", + "thu": "czwartek", + "fri": "piątek", + "sat": "sobota" + } + }, + "stand-alone": { + "abbreviated": { + "sun": "niedz.", + "mon": "pon.", + "tue": "wt.", + "wed": "śr.", + "thu": "czw.", + "fri": "pt.", + "sat": "sob." + }, + "narrow": { + "sun": "N", + "mon": "P", + "tue": "W", + "wed": "Ś", + "thu": "C", + "fri": "P", + "sat": "S" + }, + "short": { + "sun": "nie", + "mon": "pon", + "tue": "wto", + "wed": "śro", + "thu": "czw", + "fri": "pią", + "sat": "sob" + }, + "wide": { + "sun": "niedziela", + "mon": "poniedziałek", + "tue": "wtorek", + "wed": "środa", + "thu": "czwartek", + "fri": "piątek", + "sat": "sobota" + } + } + }, + "quarters": { + "format": { + "abbreviated": { + "1": "I kw.", + "2": "II kw.", + "3": "III kw.", + "4": "IV kw." + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "I kwartał", + "2": "II kwartał", + "3": "III kwartał", + "4": "IV kwartał" + } + }, + "stand-alone": { + "abbreviated": { + "1": "I kw.", + "2": "II kw.", + "3": "III kw.", + "4": "IV kw." + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "I kwartał", + "2": "II kwartał", + "3": "III kwartał", + "4": "IV kwartał" + } + } + }, + "dayPeriods": { + "format": { + "abbreviated": { + "midnight": "o północy", + "am": "AM", + "noon": "w południe", + "pm": "PM", + "morning1": "rano", + "morning2": "przed południem", + "afternoon1": "po południu", + "evening1": "wieczorem", + "night1": "w nocy" + }, + "narrow": { + "midnight": "o półn.", + "am": "a", + "noon": "w poł.", + "pm": "p", + "morning1": "rano", + "morning2": "przed poł.", + "afternoon1": "po poł.", + "evening1": "wiecz.", + "night1": "w nocy" + }, + "wide": { + "midnight": "o północy", + "am": "AM", + "noon": "w południe", + "pm": "PM", + "morning1": "rano", + "morning2": "przed południem", + "afternoon1": "po południu", + "evening1": "wieczorem", + "night1": "w nocy" + } + }, + "stand-alone": { + "abbreviated": { + "midnight": "północ", + "am": "AM", + "noon": "południe", + "pm": "PM", + "morning1": "rano", + "morning2": "przedpołudnie", + "afternoon1": "popołudnie", + "evening1": "wieczór", + "night1": "noc" + }, + "narrow": { + "midnight": "półn.", + "am": "a", + "noon": "poł.", + "pm": "p", + "morning1": "rano", + "morning2": "przedpoł.", + "afternoon1": "popoł.", + "evening1": "wiecz.", + "night1": "noc" + }, + "wide": { + "midnight": "północ", + "am": "AM", + "noon": "południe", + "pm": "PM", + "morning1": "rano", + "morning2": "przedpołudnie", + "afternoon1": "popołudnie", + "evening1": "wieczór", + "night1": "noc" + } + } + }, + "eras": { + "eraNames": { + "0": "ERA0", + "1": "ERA1" + }, + "eraAbbr": { + "0": "ERA0", + "1": "ERA1" + }, + "eraNarrow": { + "0": "ERA0", + "1": "ERA1" + } + }, + "dateFormats": { + "full": "EEEE, d MMMM y G", + "long": "d MMMM y G", + "medium": "d MMM y G", + "short": "dd.MM.y G" + }, + "timeFormats": { + "full": "HH:mm:ss zzzz", + "long": "HH:mm:ss z", + "medium": "HH:mm:ss", + "short": "HH:mm" + }, + "dateTimeFormats": { + "full": "{1}, {0}", + "long": "{1}, {0}", + "medium": "{1}, {0}", + "short": "{1}, {0}", + "availableFormats": { + "Bh": "h B", + "Bhm": "h:mm B", + "Bhms": "h:mm:ss B", + "d": "d", + "E": "ccc", + "EBhm": "E h:mm B", + "EBhms": "E h:mm:ss B", + "Ed": "E, d", + "Ehm": "E h:mm a", + "EHm": "E HH:mm", + "Ehms": "E h:mm:ss a", + "EHms": "E HH:mm:ss", + "Gy": "y G", + "GyMMM": "LLL y G", + "GyMMMd": "d MMM y G", + "GyMMMEd": "E, d MMM y G", + "h": "hh a", + "H": "HH", + "hm": "hh:mm a", + "Hm": "HH:mm", + "hms": "hh:mm:ss a", + "Hms": "HH:mm:ss", + "M": "L", + "Md": "d.MM", + "MEd": "E, d.MM", + "MMdd": "d.MM", + "MMM": "LLL", + "MMMd": "d MMM", + "MMMEd": "E, d MMM", + "MMMMd": "d MMMM", + "ms": "mm:ss", + "y": "y G", + "yyyy": "y G", + "yyyyM": "MM.y G", + "yyyyMd": "d.MM.y G", + "yyyyMEd": "E, d.MM.y G", + "yyyyMM": "MM.y G", + "yyyyMMM": "LLL y G", + "yyyyMMMd": "d MMM y G", + "yyyyMMMEd": "E, d MMM y G", + "yyyyMMMM": "LLLL y G", + "yyyyQQQ": "QQQ y G", + "yyyyQQQQ": "QQQQ y G" + }, + "appendItems": { + "Day": "{0} ({2}: {1})", + "Day-Of-Week": "{0} {1}", + "Era": "{1} {0}", + "Hour": "{0} ({2}: {1})", + "Minute": "{0} ({2}: {1})", + "Month": "{0} ({2}: {1})", + "Quarter": "{0} ({2}: {1})", + "Second": "{0} ({2}: {1})", + "Timezone": "{0} {1}", + "Week": "{0} ({2}: {1})", + "Year": "{1} {0}" + }, + "intervalFormats": { + "intervalFormatFallback": "{0} – {1}", + "Bh": { + "B": "h B – h B", + "h": "h–h B" + }, + "Bhm": { + "B": "h:mm B – h:mm B", + "h": "h:mm–h:mm B", + "m": "h:mm–h:mm B" + }, + "d": { + "d": "d–d" + }, + "Gy": { + "G": "y G – y G", + "y": "y–y G" + }, + "GyM": { + "G": "MM.y GGGGG – MM.y GGGGG", + "M": "MM.y – MM.y GGGGG", + "y": "MM.y – MM.y GGGGG" + }, + "GyMd": { + "d": "dd.MM.y – dd.MM.y GGGGG", + "G": "dd.MM.y GGGGG – dd.MM.y GGGGG", + "M": "dd.MM.y – dd.MM.y GGGGG", + "y": "dd.MM.y – dd.MM.y GGGGG" + }, + "GyMEd": { + "d": "E, dd.MM.y – E, dd.MM.y GGGGG", + "G": "E, dd.MM.y GGGGG – E, dd.MM.y GGGGG", + "M": "E, dd.MM.y – E, dd.MM.y GGGGG", + "y": "E, dd.MM.y – E, dd.MM.y GGGGG" + }, + "GyMMM": { + "G": "MMM y G – MMM y G", + "M": "MMM – MMM y G", + "y": "MMM y – MMM y G" + }, + "GyMMMd": { + "d": "d–d MMM y G", + "G": "d MMM y G – d MMM y G", + "M": "d MMM – d MMM y G", + "y": "d MMM y – d MMM y G" + }, + "GyMMMEd": { + "d": "E, d MMM – E, d MMM y G", + "G": "E, d MMM y G – E, d MMM y G", + "M": "E, d MMM – E, d MMM y G", + "y": "E, d MMM y – E, d MMM y G" + }, + "h": { + "a": "h a – h a", + "h": "h–h a" + }, + "H": { + "H": "HH–HH" + }, + "hm": { + "a": "h:mm a – h:mm a", + "h": "h:mm–h:mm a", + "m": "h:mm–h:mm a" + }, + "Hm": { + "H": "HH:mm–HH:mm", + "m": "HH:mm–HH:mm" + }, + "hmv": { + "a": "h:mm a – h:mm a v", + "h": "h:mm–h:mm a v", + "m": "h:mm–h:mm a v" + }, + "Hmv": { + "H": "HH:mm–HH:mm v", + "m": "HH:mm–HH:mm v" + }, + "hv": { + "a": "h a – h a v", + "h": "h–h a v" + }, + "Hv": { + "H": "HH–HH v" + }, + "M": { + "M": "MM–MM" + }, + "Md": { + "d": "dd.MM–dd.MM", + "M": "dd.MM–dd.MM" + }, + "MEd": { + "d": "E, dd.MM – E, dd.MM", + "M": "E, dd.MM – E, dd.MM" + }, + "MMM": { + "M": "LLL–LLL" + }, + "MMMd": { + "d": "d–d MMM", + "M": "d MMM – d MMM" + }, + "MMMEd": { + "d": "E, d MMM – E, d MMM", + "M": "E, d MMM – E, d MMM" + }, + "y": { + "y": "y–y G" + }, + "yM": { + "M": "MM.y – MM.y GGGGG", + "y": "MM.y – MM.y GGGGG" + }, + "yMd": { + "d": "dd–dd.MM.y GGGGG", + "M": "dd.MM–dd.MM.y GGGGG", + "y": "dd.MM.y–dd.MM.y G" + }, + "yMEd": { + "d": "E, dd.MM.y – E, dd.MM.y G", + "M": "E, dd.MM.y – E, dd.MM.y G", + "y": "E, dd.MM.y – E, dd.MM.y GGGGG" + }, + "yMMM": { + "M": "LLL–LLL y G", + "y": "LLL y – LLL y G" + }, + "yMMMd": { + "d": "d–d MMM y G", + "M": "d MMM – d MMM y G", + "y": "d MMM y – d MMM y G" + }, + "yMMMEd": { + "d": "E, d – E, d MMM y G", + "M": "E, d MMM – E, d MMM y G", + "y": "E, d MMM y – E, d MMM y G" + }, + "yMMMM": { + "M": "LLLL–LLLL y G", + "y": "LLLL y – LLLL y G" + } + } + } + } + } + } + } + } +} diff --git a/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/ca-gregorian.json b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/ca-gregorian.json new file mode 100755 index 00000000000..52ff149c72d --- /dev/null +++ b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/ca-gregorian.json @@ -0,0 +1,571 @@ +{ + "main": { + "pl": { + "identity": { + "version": { + "_cldrVersion": "37" + }, + "language": "pl" + }, + "dates": { + "calendars": { + "gregorian": { + "months": { + "format": { + "abbreviated": { + "1": "sty", + "2": "lut", + "3": "mar", + "4": "kwi", + "5": "maj", + "6": "cze", + "7": "lip", + "8": "sie", + "9": "wrz", + "10": "paź", + "11": "lis", + "12": "gru" + }, + "narrow": { + "1": "s", + "2": "l", + "3": "m", + "4": "k", + "5": "m", + "6": "c", + "7": "l", + "8": "s", + "9": "w", + "10": "p", + "11": "l", + "12": "g" + }, + "wide": { + "1": "stycznia", + "2": "lutego", + "3": "marca", + "4": "kwietnia", + "5": "maja", + "6": "czerwca", + "7": "lipca", + "8": "sierpnia", + "9": "września", + "10": "października", + "11": "listopada", + "12": "grudnia" + } + }, + "stand-alone": { + "abbreviated": { + "1": "sty", + "2": "lut", + "3": "mar", + "4": "kwi", + "5": "maj", + "6": "cze", + "7": "lip", + "8": "sie", + "9": "wrz", + "10": "paź", + "11": "lis", + "12": "gru" + }, + "narrow": { + "1": "S", + "2": "L", + "3": "M", + "4": "K", + "5": "M", + "6": "C", + "7": "L", + "8": "S", + "9": "W", + "10": "P", + "11": "L", + "12": "G" + }, + "wide": { + "1": "styczeń", + "2": "luty", + "3": "marzec", + "4": "kwiecień", + "5": "maj", + "6": "czerwiec", + "7": "lipiec", + "8": "sierpień", + "9": "wrzesień", + "10": "październik", + "11": "listopad", + "12": "grudzień" + } + } + }, + "days": { + "format": { + "abbreviated": { + "sun": "niedz.", + "mon": "pon.", + "tue": "wt.", + "wed": "śr.", + "thu": "czw.", + "fri": "pt.", + "sat": "sob." + }, + "narrow": { + "sun": "n", + "mon": "p", + "tue": "w", + "wed": "ś", + "thu": "c", + "fri": "p", + "sat": "s" + }, + "short": { + "sun": "nie", + "mon": "pon", + "tue": "wto", + "wed": "śro", + "thu": "czw", + "fri": "pią", + "sat": "sob" + }, + "wide": { + "sun": "niedziela", + "mon": "poniedziałek", + "tue": "wtorek", + "wed": "środa", + "thu": "czwartek", + "fri": "piątek", + "sat": "sobota" + } + }, + "stand-alone": { + "abbreviated": { + "sun": "niedz.", + "mon": "pon.", + "tue": "wt.", + "wed": "śr.", + "thu": "czw.", + "fri": "pt.", + "sat": "sob." + }, + "narrow": { + "sun": "N", + "mon": "P", + "tue": "W", + "wed": "Ś", + "thu": "C", + "fri": "P", + "sat": "S" + }, + "short": { + "sun": "nie", + "mon": "pon", + "tue": "wto", + "wed": "śro", + "thu": "czw", + "fri": "pią", + "sat": "sob" + }, + "wide": { + "sun": "niedziela", + "mon": "poniedziałek", + "tue": "wtorek", + "wed": "środa", + "thu": "czwartek", + "fri": "piątek", + "sat": "sobota" + } + } + }, + "quarters": { + "format": { + "abbreviated": { + "1": "I kw.", + "2": "II kw.", + "3": "III kw.", + "4": "IV kw." + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "I kwartał", + "2": "II kwartał", + "3": "III kwartał", + "4": "IV kwartał" + } + }, + "stand-alone": { + "abbreviated": { + "1": "I kw.", + "2": "II kw.", + "3": "III kw.", + "4": "IV kw." + }, + "narrow": { + "1": "1", + "2": "2", + "3": "3", + "4": "4" + }, + "wide": { + "1": "I kwartał", + "2": "II kwartał", + "3": "III kwartał", + "4": "IV kwartał" + } + } + }, + "dayPeriods": { + "format": { + "abbreviated": { + "midnight": "o północy", + "am": "AM", + "noon": "w południe", + "pm": "PM", + "morning1": "rano", + "morning2": "przed południem", + "afternoon1": "po południu", + "evening1": "wieczorem", + "night1": "w nocy" + }, + "narrow": { + "midnight": "o półn.", + "am": "a", + "noon": "w poł.", + "pm": "p", + "morning1": "rano", + "morning2": "przed poł.", + "afternoon1": "po poł.", + "evening1": "wiecz.", + "night1": "w nocy" + }, + "wide": { + "midnight": "o północy", + "am": "AM", + "noon": "w południe", + "pm": "PM", + "morning1": "rano", + "morning2": "przed południem", + "afternoon1": "po południu", + "evening1": "wieczorem", + "night1": "w nocy" + } + }, + "stand-alone": { + "abbreviated": { + "midnight": "północ", + "am": "AM", + "noon": "południe", + "pm": "PM", + "morning1": "rano", + "morning2": "przedpołudnie", + "afternoon1": "popołudnie", + "evening1": "wieczór", + "night1": "noc" + }, + "narrow": { + "midnight": "półn.", + "am": "a", + "noon": "poł.", + "pm": "p", + "morning1": "rano", + "morning2": "przedpoł.", + "afternoon1": "popoł.", + "evening1": "wiecz.", + "night1": "noc" + }, + "wide": { + "midnight": "północ", + "am": "AM", + "noon": "południe", + "pm": "PM", + "morning1": "rano", + "morning2": "przedpołudnie", + "afternoon1": "popołudnie", + "evening1": "wieczór", + "night1": "noc" + } + } + }, + "eras": { + "eraNames": { + "0": "przed naszą erą", + "0-alt-variant": "p.n.e.", + "1": "naszej ery", + "1-alt-variant": "n.e." + }, + "eraAbbr": { + "0": "p.n.e.", + "0-alt-variant": "BCE", + "1": "n.e.", + "1-alt-variant": "CE" + }, + "eraNarrow": { + "0": "p.n.e.", + "0-alt-variant": "BCE", + "1": "n.e.", + "1-alt-variant": "CE" + } + }, + "dateFormats": { + "full": "EEEE, d MMMM y", + "long": "d MMMM y", + "medium": "d MMM y", + "short": "dd.MM.y" + }, + "timeFormats": { + "full": "HH:mm:ss zzzz", + "long": "HH:mm:ss z", + "medium": "HH:mm:ss", + "short": "HH:mm" + }, + "dateTimeFormats": { + "full": "{1} {0}", + "long": "{1} {0}", + "medium": "{1}, {0}", + "short": "{1}, {0}", + "availableFormats": { + "Bh": "h B", + "Bhm": "h:mm B", + "Bhms": "h:mm:ss B", + "d": "d", + "E": "ccc", + "EBhm": "E h:mm B", + "EBhms": "E h:mm:ss B", + "Ed": "E, d", + "Ehm": "E, h:mm a", + "EHm": "E, HH:mm", + "Ehms": "E, h:mm:ss a", + "EHms": "E, HH:mm:ss", + "Gy": "y G", + "GyMMM": "MMM y G", + "GyMMMd": "d MMM y G", + "GyMMMEd": "E, d MMM y G", + "GyMMMM": "LLLL y G", + "GyMMMMd": "d MMMM y G", + "GyMMMMEd": "E, d MMMM y G", + "h": "h a", + "H": "HH", + "hm": "h:mm a", + "Hm": "HH:mm", + "hms": "h:mm:ss a", + "Hms": "HH:mm:ss", + "hmsv": "h:mm:ss a v", + "Hmsv": "HH:mm:ss v", + "hmv": "h:mm a v", + "Hmv": "HH:mm v", + "M": "L", + "Md": "d.MM", + "MEd": "E, d.MM", + "MMM": "LLL", + "MMMd": "d MMM", + "MMMEd": "E, d MMM", + "MMMMd": "d MMMM", + "MMMMEd": "E, d MMMM", + "MMMMW-count-one": "LLLL, 'tydz'. W", + "MMMMW-count-few": "LLLL, 'tydz'. W", + "MMMMW-count-many": "LLLL, 'tydz'. W", + "MMMMW-count-other": "LLLL, 'tydz'. W", + "ms": "mm:ss", + "y": "y", + "yM": "MM.y", + "yMd": "d.MM.y", + "yMEd": "E, d.MM.y", + "yMMM": "LLL y", + "yMMMd": "d MMM y", + "yMMMEd": "E, d MMM y", + "yMMMM": "LLLL y", + "yMMMMd": "d MMMM y", + "yMMMMEd": "E, d MMMM y", + "yQQQ": "QQQ y", + "yQQQQ": "QQQQ y", + "yw-count-one": "Y, 'tydz'. w", + "yw-count-few": "Y, 'tydz'. w", + "yw-count-many": "Y, 'tydz'. w", + "yw-count-other": "Y, 'tydz'. w" + }, + "appendItems": { + "Day": "{0} ({2}: {1})", + "Day-Of-Week": "{0} {1}", + "Era": "{1} {0}", + "Hour": "{0} ({2}: {1})", + "Minute": "{0} ({2}: {1})", + "Month": "{0} ({2}: {1})", + "Quarter": "{0} ({2}: {1})", + "Second": "{0} ({2}: {1})", + "Timezone": "{0} {1}", + "Week": "{0} ({2}: {1})", + "Year": "{1} {0}" + }, + "intervalFormats": { + "intervalFormatFallback": "{0}–{1}", + "Bh": { + "B": "h B – h B", + "h": "h–h B" + }, + "Bhm": { + "B": "h:mm B – h:mm B", + "h": "h:mm–h:mm B", + "m": "h:mm–h:mm B" + }, + "d": { + "d": "d–d" + }, + "Gy": { + "G": "y G – y G", + "y": "y–y G" + }, + "GyM": { + "G": "M.y GGGGG – M.y GGGGG", + "M": "M.y – M.y GGGGG", + "y": "M.y – M.y GGGGG" + }, + "GyMd": { + "d": "d.M.y – d.M.y GGGGG", + "G": "d.M.y GGGGG – d.M.y GGGGG", + "M": "d.M.y – d.M.y GGGGG", + "y": "d.M.y – d.M.y GGGGG" + }, + "GyMEd": { + "d": "E, d.M.y – E, d.M.y GGGGG", + "G": "E, d.M.y GGGGG – E, d.M.y GGGGG", + "M": "E, d.M.y – E, d.M.y GGGGG", + "y": "E, d.M.y – E, d.M.y GGGGG" + }, + "GyMMM": { + "G": "MMM y G – MMM y G", + "M": "MMM – MMM y G", + "y": "MMM y – MMM y G" + }, + "GyMMMd": { + "d": "d–d MMM y G", + "G": "d MMM y G – d MMM y G", + "M": "d MMM – d MMM y G", + "y": "d MMM y – d MMM y G" + }, + "GyMMMEd": { + "d": "E, d MMM – E, d MMM y G", + "G": "E, d MMM y G – E, d MMM y G", + "M": "E, d MMM – E, d MMM y G", + "y": "E, d MMM y – E, d MMM y G" + }, + "h": { + "a": "h a–h a", + "h": "h–h a" + }, + "H": { + "H": "HH–HH" + }, + "hm": { + "a": "h:mm a–h:mm a", + "h": "h:mm–h:mm a", + "m": "h:mm–h:mm a" + }, + "Hm": { + "H": "HH:mm–HH:mm", + "m": "HH:mm–HH:mm" + }, + "hmv": { + "a": "h:mm a–h:mm a v", + "h": "h:mm–h:mm a v", + "m": "h:mm–h:mm a v" + }, + "Hmv": { + "H": "HH:mm–HH:mm v", + "m": "HH:mm–HH:mm v" + }, + "hv": { + "a": "h a – h a v", + "h": "h–h a v" + }, + "Hv": { + "H": "HH–HH v" + }, + "M": { + "M": "MM–MM" + }, + "Md": { + "d": "dd.MM–dd.MM", + "M": "dd.MM–dd.MM" + }, + "MEd": { + "d": "E, dd.MM–E, dd.MM", + "M": "E, dd.MM–E, dd.MM" + }, + "MMM": { + "M": "LLL–LLL" + }, + "MMMd": { + "d": "d–d MMM", + "M": "d MMM–d MMM" + }, + "MMMEd": { + "d": "E, d MMM–E, d MMM", + "M": "E, d MMM–E, d MMM" + }, + "MMMMd": { + "d": "d–d MMMM", + "M": "d MMMM – d MMMM" + }, + "MMMMEd": { + "d": "E, d MMMM – E, d MMMM", + "M": "E, d MMMM – E, d MMMM" + }, + "y": { + "y": "y–y" + }, + "yM": { + "M": "MM.y–MM.y", + "y": "MM.y–MM.y" + }, + "yMd": { + "d": "dd–dd.MM.y", + "M": "dd.MM–dd.MM.y", + "y": "dd.MM.y–dd.MM.y" + }, + "yMEd": { + "d": "E, dd.MM.y–E, dd.MM.y", + "M": "E, dd.MM.y–E, dd.MM.y", + "y": "E, dd.MM.y–E, dd.MM.y" + }, + "yMMM": { + "M": "LLL–LLL y", + "y": "LLL y–LLL y" + }, + "yMMMd": { + "d": "d–d MMM y", + "M": "d MMM–d MMM y", + "y": "d MMM y–d MMM y" + }, + "yMMMEd": { + "d": "E, d–E, d MMM y", + "M": "E, d MMM y–E, d MMM y", + "y": "E, d MMM y–E, d MMM y" + }, + "yMMMM": { + "M": "LLLL–LLLL y", + "y": "LLLL y–LLLL y" + }, + "yMMMMd": { + "d": "d–d MMMM y", + "M": "d MMMM – d MMMM y", + "y": "d MMMM y – d MMMM y" + }, + "yMMMMEd": { + "d": "E, d – E, d MMMM y", + "M": "E, d MMMM – E, d MMMM y", + "y": "E, d MMMM y – E, d MMMM y" + } + } + } + } + } + } + } + } +} diff --git a/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/dateFields.json b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/dateFields.json new file mode 100755 index 00000000000..6a3594fd1dd --- /dev/null +++ b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/dateFields.json @@ -0,0 +1,859 @@ +{ + "main": { + "pl": { + "identity": { + "version": { + "_cldrVersion": "37" + }, + "language": "pl" + }, + "dates": { + "fields": { + "era": { + "displayName": "era" + }, + "era-short": { + "displayName": "era" + }, + "era-narrow": { + "displayName": "era" + }, + "year": { + "displayName": "rok", + "relative-type--1": "w zeszłym roku", + "relative-type-0": "w tym roku", + "relative-type-1": "w przyszłym roku", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} rok", + "relativeTimePattern-count-few": "za {0} lata", + "relativeTimePattern-count-many": "za {0} lat", + "relativeTimePattern-count-other": "za {0} roku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} rok temu", + "relativeTimePattern-count-few": "{0} lata temu", + "relativeTimePattern-count-many": "{0} lat temu", + "relativeTimePattern-count-other": "{0} roku temu" + } + }, + "year-short": { + "displayName": "r.", + "relative-type--1": "w zeszłym roku", + "relative-type-0": "w tym roku", + "relative-type-1": "w przyszłym roku", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} rok", + "relativeTimePattern-count-few": "za {0} lata", + "relativeTimePattern-count-many": "za {0} lat", + "relativeTimePattern-count-other": "za {0} roku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} rok temu", + "relativeTimePattern-count-few": "{0} lata temu", + "relativeTimePattern-count-many": "{0} lat temu", + "relativeTimePattern-count-other": "{0} roku temu" + } + }, + "year-narrow": { + "displayName": "r.", + "relative-type--1": "w zeszłym roku", + "relative-type-0": "w tym roku", + "relative-type-1": "w przyszłym roku", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} rok", + "relativeTimePattern-count-few": "za {0} lata", + "relativeTimePattern-count-many": "za {0} lat", + "relativeTimePattern-count-other": "za {0} roku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} rok temu", + "relativeTimePattern-count-few": "{0} lata temu", + "relativeTimePattern-count-many": "{0} lat temu", + "relativeTimePattern-count-other": "{0} roku temu" + } + }, + "quarter": { + "displayName": "kwartał", + "relative-type--1": "w zeszłym kwartale", + "relative-type-0": "w tym kwartale", + "relative-type-1": "w przyszłym kwartale", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} kwartał", + "relativeTimePattern-count-few": "za {0} kwartały", + "relativeTimePattern-count-many": "za {0} kwartałów", + "relativeTimePattern-count-other": "za {0} kwartału" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} kwartał temu", + "relativeTimePattern-count-few": "{0} kwartały temu", + "relativeTimePattern-count-many": "{0} kwartałów temu", + "relativeTimePattern-count-other": "{0} kwartału temu" + } + }, + "quarter-short": { + "displayName": "kw.", + "relative-type--1": "w zeszłym kwartale", + "relative-type-0": "w tym kwartale", + "relative-type-1": "w przyszłym kwartale", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} kw.", + "relativeTimePattern-count-few": "za {0} kw.", + "relativeTimePattern-count-many": "za {0} kw.", + "relativeTimePattern-count-other": "za {0} kw." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} kw. temu", + "relativeTimePattern-count-few": "{0} kw. temu", + "relativeTimePattern-count-many": "{0} kw. temu", + "relativeTimePattern-count-other": "{0} kw. temu" + } + }, + "quarter-narrow": { + "displayName": "kw.", + "relative-type--1": "w zeszłym kwartale", + "relative-type-0": "w tym kwartale", + "relative-type-1": "w przyszłym kwartale", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} kw.", + "relativeTimePattern-count-few": "za {0} kw.", + "relativeTimePattern-count-many": "za {0} kw.", + "relativeTimePattern-count-other": "za {0} kw." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} kw. temu", + "relativeTimePattern-count-few": "{0} kw. temu", + "relativeTimePattern-count-many": "{0} kw. temu", + "relativeTimePattern-count-other": "{0} kw. temu" + } + }, + "month": { + "displayName": "miesiąc", + "relative-type--1": "w zeszłym miesiącu", + "relative-type-0": "w tym miesiącu", + "relative-type-1": "w przyszłym miesiącu", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} miesiąc", + "relativeTimePattern-count-few": "za {0} miesiące", + "relativeTimePattern-count-many": "za {0} miesięcy", + "relativeTimePattern-count-other": "za {0} miesiąca" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} miesiąc temu", + "relativeTimePattern-count-few": "{0} miesiące temu", + "relativeTimePattern-count-many": "{0} miesięcy temu", + "relativeTimePattern-count-other": "{0} miesiąca temu" + } + }, + "month-short": { + "displayName": "mies.", + "relative-type--1": "w zeszłym mies.", + "relative-type-0": "w tym mies.", + "relative-type-1": "w przyszłym mies.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} mies.", + "relativeTimePattern-count-few": "za {0} mies.", + "relativeTimePattern-count-many": "za {0} mies.", + "relativeTimePattern-count-other": "za {0} mies." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} mies. temu", + "relativeTimePattern-count-few": "{0} mies. temu", + "relativeTimePattern-count-many": "{0} mies. temu", + "relativeTimePattern-count-other": "{0} mies. temu" + } + }, + "month-narrow": { + "displayName": "mc", + "relative-type--1": "w zeszłym mies.", + "relative-type-0": "w tym mies.", + "relative-type-1": "w przyszłym mies.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} mies.", + "relativeTimePattern-count-few": "za {0} mies.", + "relativeTimePattern-count-many": "za {0} mies.", + "relativeTimePattern-count-other": "za {0} mies." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} mies. temu", + "relativeTimePattern-count-few": "{0} mies. temu", + "relativeTimePattern-count-many": "{0} mies. temu", + "relativeTimePattern-count-other": "{0} mies. temu" + } + }, + "week": { + "displayName": "tydzień", + "relative-type--1": "w zeszłym tygodniu", + "relative-type-0": "w tym tygodniu", + "relative-type-1": "w przyszłym tygodniu", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} tydzień", + "relativeTimePattern-count-few": "za {0} tygodnie", + "relativeTimePattern-count-many": "za {0} tygodni", + "relativeTimePattern-count-other": "za {0} tygodnia" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} tydzień temu", + "relativeTimePattern-count-few": "{0} tygodnie temu", + "relativeTimePattern-count-many": "{0} tygodni temu", + "relativeTimePattern-count-other": "{0} tygodnia temu" + }, + "relativePeriod": "tydzień {0}" + }, + "week-short": { + "displayName": "tydz.", + "relative-type--1": "w zeszłym tyg.", + "relative-type-0": "w tym tyg.", + "relative-type-1": "w przyszłym tyg.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} tydz.", + "relativeTimePattern-count-few": "za {0} tyg.", + "relativeTimePattern-count-many": "za {0} tyg.", + "relativeTimePattern-count-other": "za {0} tyg." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} tydz. temu", + "relativeTimePattern-count-few": "{0} tyg. temu", + "relativeTimePattern-count-many": "{0} tyg. temu", + "relativeTimePattern-count-other": "{0} tyg. temu" + }, + "relativePeriod": "tydzień {0}" + }, + "week-narrow": { + "displayName": "tydz.", + "relative-type--1": "w zeszłym tyg.", + "relative-type-0": "w tym tyg.", + "relative-type-1": "w przyszłym tyg.", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} tydz.", + "relativeTimePattern-count-few": "za {0} tyg.", + "relativeTimePattern-count-many": "za {0} tyg.", + "relativeTimePattern-count-other": "za {0} tyg." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} tydz. temu", + "relativeTimePattern-count-few": "{0} tyg. temu", + "relativeTimePattern-count-many": "{0} tyg. temu", + "relativeTimePattern-count-other": "{0} tyg. temu" + }, + "relativePeriod": "tydzień {0}" + }, + "weekOfMonth": { + "displayName": "tydzień miesiąca" + }, + "weekOfMonth-short": { + "displayName": "tydz. mies." + }, + "weekOfMonth-narrow": { + "displayName": "tydz. mies." + }, + "day": { + "displayName": "dzień", + "relative-type--2": "przedwczoraj", + "relative-type--1": "wczoraj", + "relative-type-0": "dzisiaj", + "relative-type-1": "jutro", + "relative-type-2": "pojutrze", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} dzień", + "relativeTimePattern-count-few": "za {0} dni", + "relativeTimePattern-count-many": "za {0} dni", + "relativeTimePattern-count-other": "za {0} dnia" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} dzień temu", + "relativeTimePattern-count-few": "{0} dni temu", + "relativeTimePattern-count-many": "{0} dni temu", + "relativeTimePattern-count-other": "{0} dnia temu" + } + }, + "day-short": { + "displayName": "dz.", + "relative-type--2": "przedwczoraj", + "relative-type--1": "wczoraj", + "relative-type-0": "dzisiaj", + "relative-type-1": "jutro", + "relative-type-2": "pojutrze", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} dzień", + "relativeTimePattern-count-few": "za {0} dni", + "relativeTimePattern-count-many": "za {0} dni", + "relativeTimePattern-count-other": "za {0} dnia" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} dzień temu", + "relativeTimePattern-count-few": "{0} dni temu", + "relativeTimePattern-count-many": "{0} dni temu", + "relativeTimePattern-count-other": "{0} dnia temu" + } + }, + "day-narrow": { + "displayName": "d.", + "relative-type--2": "przedwczoraj", + "relative-type--1": "wcz.", + "relative-type-0": "dziś", + "relative-type-1": "jutro", + "relative-type-2": "pojutrze", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} dzień", + "relativeTimePattern-count-few": "za {0} dni", + "relativeTimePattern-count-many": "za {0} dni", + "relativeTimePattern-count-other": "za {0} dnia" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} dzień temu", + "relativeTimePattern-count-few": "{0} dni temu", + "relativeTimePattern-count-many": "{0} dni temu", + "relativeTimePattern-count-other": "{0} dnia temu" + } + }, + "dayOfYear": { + "displayName": "dzień roku" + }, + "dayOfYear-short": { + "displayName": "dz. roku" + }, + "dayOfYear-narrow": { + "displayName": "dz. r." + }, + "weekday": { + "displayName": "dzień tygodnia" + }, + "weekday-short": { + "displayName": "dzień tyg." + }, + "weekday-narrow": { + "displayName": "dz. tyg." + }, + "weekdayOfMonth": { + "displayName": "dzień miesiąca" + }, + "weekdayOfMonth-short": { + "displayName": "dzień mies." + }, + "weekdayOfMonth-narrow": { + "displayName": "dz. mies." + }, + "sun": { + "relative-type--1": "w zeszłą niedzielę", + "relative-type-0": "w tę niedzielę", + "relative-type-1": "w przyszłą niedzielę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} niedzielę", + "relativeTimePattern-count-few": "za {0} niedziele", + "relativeTimePattern-count-many": "za {0} niedziel", + "relativeTimePattern-count-other": "za {0} niedzieli" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} niedzielę temu", + "relativeTimePattern-count-few": "{0} niedziele temu", + "relativeTimePattern-count-many": "{0} niedziel temu", + "relativeTimePattern-count-other": "{0} niedzieli temu" + } + }, + "sun-short": { + "relative-type--1": "w zeszłą niedzielę", + "relative-type-0": "w tę niedzielę", + "relative-type-1": "w przyszłą niedzielę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} niedzielę", + "relativeTimePattern-count-few": "za {0} niedziele", + "relativeTimePattern-count-many": "za {0} niedziel", + "relativeTimePattern-count-other": "za {0} niedzieli" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} niedzielę temu", + "relativeTimePattern-count-few": "{0} niedziele temu", + "relativeTimePattern-count-many": "{0} niedziel temu", + "relativeTimePattern-count-other": "{0} niedzieli temu" + } + }, + "sun-narrow": { + "relative-type--1": "w zeszłą niedzielę", + "relative-type-0": "w tę niedzielę", + "relative-type-1": "w przyszłą niedzielę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} niedzielę", + "relativeTimePattern-count-few": "za {0} niedziele", + "relativeTimePattern-count-many": "za {0} niedziel", + "relativeTimePattern-count-other": "za {0} niedzieli" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} niedzielę temu", + "relativeTimePattern-count-few": "{0} niedziele temu", + "relativeTimePattern-count-many": "{0} niedziel temu", + "relativeTimePattern-count-other": "{0} niedzieli temu" + } + }, + "mon": { + "relative-type--1": "w zeszły poniedziałek", + "relative-type-0": "w ten poniedziałek", + "relative-type-1": "w przyszły poniedziałek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} poniedziałek", + "relativeTimePattern-count-few": "za {0} poniedziałki", + "relativeTimePattern-count-many": "za {0} poniedziałków", + "relativeTimePattern-count-other": "za {0} poniedziałku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} poniedziałek temu", + "relativeTimePattern-count-few": "{0} poniedziałki temu", + "relativeTimePattern-count-many": "{0} poniedziałków temu", + "relativeTimePattern-count-other": "{0} poniedziałku temu" + } + }, + "mon-short": { + "relative-type--1": "w zeszły poniedziałek", + "relative-type-0": "w ten poniedziałek", + "relative-type-1": "w przyszły poniedziałek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} poniedziałek", + "relativeTimePattern-count-few": "za {0} poniedziałki", + "relativeTimePattern-count-many": "za {0} poniedziałków", + "relativeTimePattern-count-other": "za {0} poniedziałku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} poniedziałek temu", + "relativeTimePattern-count-few": "{0} poniedziałki temu", + "relativeTimePattern-count-many": "{0} poniedziałków temu", + "relativeTimePattern-count-other": "{0} poniedziałku temu" + } + }, + "mon-narrow": { + "relative-type--1": "w zeszły poniedziałek", + "relative-type-0": "w ten poniedziałek", + "relative-type-1": "w przyszły poniedziałek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} poniedziałek", + "relativeTimePattern-count-few": "za {0} poniedziałki", + "relativeTimePattern-count-many": "za {0} poniedziałków", + "relativeTimePattern-count-other": "za {0} poniedziałku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} poniedziałek temu", + "relativeTimePattern-count-few": "{0} poniedziałki temu", + "relativeTimePattern-count-many": "{0} poniedziałków temu", + "relativeTimePattern-count-other": "{0} poniedziałku temu" + } + }, + "tue": { + "relative-type--1": "w zeszły wtorek", + "relative-type-0": "w ten wtorek", + "relative-type-1": "w przyszły wtorek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} wtorek", + "relativeTimePattern-count-few": "za {0} wtorki", + "relativeTimePattern-count-many": "za {0} wtorków", + "relativeTimePattern-count-other": "za {0} wtorku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} wtorek temu", + "relativeTimePattern-count-few": "{0} wtorki temu", + "relativeTimePattern-count-many": "{0} wtorków temu", + "relativeTimePattern-count-other": "{0} wtorku temu" + } + }, + "tue-short": { + "relative-type--1": "w zeszły wtorek", + "relative-type-0": "w ten wtorek", + "relative-type-1": "w przyszły wtorek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} wtorek", + "relativeTimePattern-count-few": "za {0} wtorki", + "relativeTimePattern-count-many": "za {0} wtorków", + "relativeTimePattern-count-other": "za {0} wtorku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} wtorek temu", + "relativeTimePattern-count-few": "{0} wtorki temu", + "relativeTimePattern-count-many": "{0} wtorków temu", + "relativeTimePattern-count-other": "{0} wtorku temu" + } + }, + "tue-narrow": { + "relative-type--1": "w zeszły wtorek", + "relative-type-0": "w ten wtorek", + "relative-type-1": "w przyszły wtorek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} wtorek", + "relativeTimePattern-count-few": "za {0} wtorki", + "relativeTimePattern-count-many": "za {0} wtorków", + "relativeTimePattern-count-other": "za {0} wtorku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} wtorek temu", + "relativeTimePattern-count-few": "{0} wtorki temu", + "relativeTimePattern-count-many": "{0} wtorków temu", + "relativeTimePattern-count-other": "{0} wtorku temu" + } + }, + "wed": { + "relative-type--1": "w zeszłą środę", + "relative-type-0": "w tę środę", + "relative-type-1": "w przyszłą środę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} środę", + "relativeTimePattern-count-few": "za {0} środy", + "relativeTimePattern-count-many": "za {0} śród", + "relativeTimePattern-count-other": "za {0} środy" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} środę temu", + "relativeTimePattern-count-few": "{0} środy temu", + "relativeTimePattern-count-many": "{0} śród temu", + "relativeTimePattern-count-other": "{0} środy temu" + } + }, + "wed-short": { + "relative-type--1": "w zeszłą środę", + "relative-type-0": "w tę środę", + "relative-type-1": "w przyszłą środę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} środę", + "relativeTimePattern-count-few": "za {0} środy", + "relativeTimePattern-count-many": "za {0} śród", + "relativeTimePattern-count-other": "za {0} środy" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} środę temu", + "relativeTimePattern-count-few": "{0} środy temu", + "relativeTimePattern-count-many": "{0} śród temu", + "relativeTimePattern-count-other": "{0} środy temu" + } + }, + "wed-narrow": { + "relative-type--1": "w zeszłą środę", + "relative-type-0": "w tę środę", + "relative-type-1": "w przyszłą środę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} środę", + "relativeTimePattern-count-few": "za {0} środy", + "relativeTimePattern-count-many": "za {0} śród", + "relativeTimePattern-count-other": "za {0} środy" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} środę temu", + "relativeTimePattern-count-few": "{0} środy temu", + "relativeTimePattern-count-many": "{0} śród temu", + "relativeTimePattern-count-other": "{0} środy temu" + } + }, + "thu": { + "relative-type--1": "w zeszły czwartek", + "relative-type-0": "w ten czwartek", + "relative-type-1": "w przyszły czwartek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} czwartek", + "relativeTimePattern-count-few": "za {0} czwartki", + "relativeTimePattern-count-many": "za {0} czwartków", + "relativeTimePattern-count-other": "za {0} czwartku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} czwartek temu", + "relativeTimePattern-count-few": "{0} czwartki temu", + "relativeTimePattern-count-many": "{0} czwartków temu", + "relativeTimePattern-count-other": "{0} czwartku temu" + } + }, + "thu-short": { + "relative-type--1": "w zeszły czwartek", + "relative-type-0": "w ten czwartek", + "relative-type-1": "w przyszły czwartek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} czwartek", + "relativeTimePattern-count-few": "za {0} czwartki", + "relativeTimePattern-count-many": "za {0} czwartków", + "relativeTimePattern-count-other": "za {0} czwartku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} czwartek temu", + "relativeTimePattern-count-few": "{0} czwartki temu", + "relativeTimePattern-count-many": "{0} czwartków temu", + "relativeTimePattern-count-other": "{0} czwartku temu" + } + }, + "thu-narrow": { + "relative-type--1": "w zeszły czwartek", + "relative-type-0": "w ten czwartek", + "relative-type-1": "w przyszły czwartek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} czwartek", + "relativeTimePattern-count-few": "za {0} czwartki", + "relativeTimePattern-count-many": "za {0} czwartków", + "relativeTimePattern-count-other": "za {0} czwartku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} czwartek temu", + "relativeTimePattern-count-few": "{0} czwartki temu", + "relativeTimePattern-count-many": "{0} czwartków temu", + "relativeTimePattern-count-other": "{0} czwartku temu" + } + }, + "fri": { + "relative-type--1": "w zeszły piątek", + "relative-type-0": "w ten piątek", + "relative-type-1": "w przyszły piątek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} piątek", + "relativeTimePattern-count-few": "za {0} piątki", + "relativeTimePattern-count-many": "za {0} piątków", + "relativeTimePattern-count-other": "za {0} piątku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} piątek temu", + "relativeTimePattern-count-few": "{0} piątki temu", + "relativeTimePattern-count-many": "{0} piątków temu", + "relativeTimePattern-count-other": "{0} piątku temu" + } + }, + "fri-short": { + "relative-type--1": "w zeszły piątek", + "relative-type-0": "w ten piątek", + "relative-type-1": "w przyszły piątek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} piątek", + "relativeTimePattern-count-few": "za {0} piątki", + "relativeTimePattern-count-many": "za {0} piątków", + "relativeTimePattern-count-other": "za {0} piątku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} piątek temu", + "relativeTimePattern-count-few": "{0} piątki temu", + "relativeTimePattern-count-many": "{0} piątków temu", + "relativeTimePattern-count-other": "{0} piątku temu" + } + }, + "fri-narrow": { + "relative-type--1": "w zeszły piątek", + "relative-type-0": "w ten piątek", + "relative-type-1": "w przyszły piątek", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} piątek", + "relativeTimePattern-count-few": "za {0} piątki", + "relativeTimePattern-count-many": "za {0} piątków", + "relativeTimePattern-count-other": "za {0} piątku" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} piątek temu", + "relativeTimePattern-count-few": "{0} piątki temu", + "relativeTimePattern-count-many": "{0} piątków temu", + "relativeTimePattern-count-other": "{0} piątku temu" + } + }, + "sat": { + "relative-type--1": "w zeszłą sobotę", + "relative-type-0": "w tę sobotę", + "relative-type-1": "w przyszłą sobotę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} sobotę", + "relativeTimePattern-count-few": "za {0} soboty", + "relativeTimePattern-count-many": "za {0} sobót", + "relativeTimePattern-count-other": "za {0} soboty" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} sobotę temu", + "relativeTimePattern-count-few": "{0} soboty temu", + "relativeTimePattern-count-many": "{0} sobót temu", + "relativeTimePattern-count-other": "{0} soboty temu" + } + }, + "sat-short": { + "relative-type--1": "w zeszłą sobotę", + "relative-type-0": "w tę sobotę", + "relative-type-1": "w przyszłą sobotę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} sobotę", + "relativeTimePattern-count-few": "za {0} soboty", + "relativeTimePattern-count-many": "za {0} sobót", + "relativeTimePattern-count-other": "za {0} soboty" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} sobotę temu", + "relativeTimePattern-count-few": "{0} soboty temu", + "relativeTimePattern-count-many": "{0} sobót temu", + "relativeTimePattern-count-other": "{0} soboty temu" + } + }, + "sat-narrow": { + "relative-type--1": "w zeszłą sobotę", + "relative-type-0": "w tę sobotę", + "relative-type-1": "w przyszłą sobotę", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} sobotę", + "relativeTimePattern-count-few": "za {0} soboty", + "relativeTimePattern-count-many": "za {0} sobót", + "relativeTimePattern-count-other": "za {0} soboty" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} sobotę temu", + "relativeTimePattern-count-few": "{0} soboty temu", + "relativeTimePattern-count-many": "{0} sobót temu", + "relativeTimePattern-count-other": "{0} soboty temu" + } + }, + "dayperiod-short": { + "displayName": "rano / po południu / wieczorem" + }, + "dayperiod": { + "displayName": "rano / po południu / wieczorem" + }, + "dayperiod-narrow": { + "displayName": "rano / po poł. / wiecz." + }, + "hour": { + "displayName": "godzina", + "relative-type-0": "ta godzina", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} godzinę", + "relativeTimePattern-count-few": "za {0} godziny", + "relativeTimePattern-count-many": "za {0} godzin", + "relativeTimePattern-count-other": "za {0} godziny" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} godzinę temu", + "relativeTimePattern-count-few": "{0} godziny temu", + "relativeTimePattern-count-many": "{0} godzin temu", + "relativeTimePattern-count-other": "{0} godziny temu" + } + }, + "hour-short": { + "displayName": "godz.", + "relative-type-0": "ta godzina", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} godz.", + "relativeTimePattern-count-few": "za {0} godz.", + "relativeTimePattern-count-many": "za {0} godz.", + "relativeTimePattern-count-other": "za {0} godz." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} godz. temu", + "relativeTimePattern-count-few": "{0} godz. temu", + "relativeTimePattern-count-many": "{0} godz. temu", + "relativeTimePattern-count-other": "{0} godz. temu" + } + }, + "hour-narrow": { + "displayName": "g.", + "relative-type-0": "ta godzina", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} g.", + "relativeTimePattern-count-few": "za {0} g.", + "relativeTimePattern-count-many": "za {0} g.", + "relativeTimePattern-count-other": "za {0} g." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} g. temu", + "relativeTimePattern-count-few": "{0} g. temu", + "relativeTimePattern-count-many": "{0} g. temu", + "relativeTimePattern-count-other": "{0} g. temu" + } + }, + "minute": { + "displayName": "minuta", + "relative-type-0": "ta minuta", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} minutę", + "relativeTimePattern-count-few": "za {0} minuty", + "relativeTimePattern-count-many": "za {0} minut", + "relativeTimePattern-count-other": "za {0} minuty" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} minutę temu", + "relativeTimePattern-count-few": "{0} minuty temu", + "relativeTimePattern-count-many": "{0} minut temu", + "relativeTimePattern-count-other": "{0} minuty temu" + } + }, + "minute-short": { + "displayName": "min", + "relative-type-0": "ta minuta", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} min", + "relativeTimePattern-count-few": "za {0} min", + "relativeTimePattern-count-many": "za {0} min", + "relativeTimePattern-count-other": "za {0} min" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} min temu", + "relativeTimePattern-count-few": "{0} min temu", + "relativeTimePattern-count-many": "{0} min temu", + "relativeTimePattern-count-other": "{0} min temu" + } + }, + "minute-narrow": { + "displayName": "min", + "relative-type-0": "ta minuta", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} min", + "relativeTimePattern-count-few": "za {0} min", + "relativeTimePattern-count-many": "za {0} min", + "relativeTimePattern-count-other": "za {0} min" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} min temu", + "relativeTimePattern-count-few": "{0} min temu", + "relativeTimePattern-count-many": "{0} min temu", + "relativeTimePattern-count-other": "{0} min temu" + } + }, + "second": { + "displayName": "sekunda", + "relative-type-0": "teraz", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} sekundę", + "relativeTimePattern-count-few": "za {0} sekundy", + "relativeTimePattern-count-many": "za {0} sekund", + "relativeTimePattern-count-other": "za {0} sekundy" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} sekundę temu", + "relativeTimePattern-count-few": "{0} sekundy temu", + "relativeTimePattern-count-many": "{0} sekund temu", + "relativeTimePattern-count-other": "{0} sekundy temu" + } + }, + "second-short": { + "displayName": "sek.", + "relative-type-0": "teraz", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} sek.", + "relativeTimePattern-count-few": "za {0} sek.", + "relativeTimePattern-count-many": "za {0} sek.", + "relativeTimePattern-count-other": "za {0} sek." + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} sek. temu", + "relativeTimePattern-count-few": "{0} sek. temu", + "relativeTimePattern-count-many": "{0} sek. temu", + "relativeTimePattern-count-other": "{0} sek. temu" + } + }, + "second-narrow": { + "displayName": "s", + "relative-type-0": "teraz", + "relativeTime-type-future": { + "relativeTimePattern-count-one": "za {0} s", + "relativeTimePattern-count-few": "za {0} s", + "relativeTimePattern-count-many": "za {0} s", + "relativeTimePattern-count-other": "za {0} s" + }, + "relativeTime-type-past": { + "relativeTimePattern-count-one": "{0} s temu", + "relativeTimePattern-count-few": "{0} s temu", + "relativeTimePattern-count-many": "{0} s temu", + "relativeTimePattern-count-other": "{0} s temu" + } + }, + "zone": { + "displayName": "strefa czasowa" + }, + "zone-short": { + "displayName": "str. czasowa" + }, + "zone-narrow": { + "displayName": "str. czas." + } + } + } + } + } +} diff --git a/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/timeZoneNames.json b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/timeZoneNames.json new file mode 100755 index 00000000000..02b5485bfaa --- /dev/null +++ b/components/datetime/tests/fixtures/data/cldr/cldr-dates-modern/main/pl/timeZoneNames.json @@ -0,0 +1,2170 @@ +{ + "main": { + "pl": { + "identity": { + "version": { + "_cldrVersion": "37" + }, + "language": "pl" + }, + "dates": { + "timeZoneNames": { + "hourFormat": "+HH:mm;-HH:mm", + "gmtFormat": "GMT{0}", + "gmtZeroFormat": "GMT", + "regionFormat": "czas: {0}", + "regionFormat-type-daylight": "{0} (czas letni)", + "regionFormat-type-standard": "{0} (czas standardowy)", + "fallbackFormat": "{1} ({0})", + "zone": { + "America": { + "Adak": { + "exemplarCity": "Adak" + }, + "Anchorage": { + "exemplarCity": "Anchorage" + }, + "Anguilla": { + "exemplarCity": "Anguilla" + }, + "Antigua": { + "exemplarCity": "Antigua" + }, + "Araguaina": { + "exemplarCity": "Araguaina" + }, + "Argentina": { + "Rio_Gallegos": { + "exemplarCity": "Rio Gallegos" + }, + "San_Juan": { + "exemplarCity": "San Juan" + }, + "Ushuaia": { + "exemplarCity": "Ushuaia" + }, + "La_Rioja": { + "exemplarCity": "La Rioja" + }, + "San_Luis": { + "exemplarCity": "San Luis" + }, + "Salta": { + "exemplarCity": "Salta" + }, + "Tucuman": { + "exemplarCity": "Tucuman" + } + }, + "Aruba": { + "exemplarCity": "Aruba" + }, + "Asuncion": { + "exemplarCity": "Asunción" + }, + "Bahia": { + "exemplarCity": "Salvador" + }, + "Bahia_Banderas": { + "exemplarCity": "Bahia Banderas" + }, + "Barbados": { + "exemplarCity": "Barbados" + }, + "Belem": { + "exemplarCity": "Belém" + }, + "Belize": { + "exemplarCity": "Belize" + }, + "Blanc-Sablon": { + "exemplarCity": "Blanc-Sablon" + }, + "Boa_Vista": { + "exemplarCity": "Boa Vista" + }, + "Bogota": { + "exemplarCity": "Bogota" + }, + "Boise": { + "exemplarCity": "Boise" + }, + "Buenos_Aires": { + "exemplarCity": "Buenos Aires" + }, + "Cambridge_Bay": { + "exemplarCity": "Cambridge Bay" + }, + "Campo_Grande": { + "exemplarCity": "Campo Grande" + }, + "Cancun": { + "exemplarCity": "Cancún" + }, + "Caracas": { + "exemplarCity": "Caracas" + }, + "Catamarca": { + "exemplarCity": "Catamarca" + }, + "Cayenne": { + "exemplarCity": "Kajenna" + }, + "Cayman": { + "exemplarCity": "Kajmany" + }, + "Chicago": { + "exemplarCity": "Chicago" + }, + "Chihuahua": { + "exemplarCity": "Chihuahua" + }, + "Coral_Harbour": { + "exemplarCity": "Atikokan" + }, + "Cordoba": { + "exemplarCity": "Córdoba" + }, + "Costa_Rica": { + "exemplarCity": "Kostaryka" + }, + "Creston": { + "exemplarCity": "Creston" + }, + "Cuiaba": { + "exemplarCity": "Cuiabá" + }, + "Curacao": { + "exemplarCity": "Curaçao" + }, + "Danmarkshavn": { + "exemplarCity": "Danmarkshavn" + }, + "Dawson": { + "exemplarCity": "Dawson" + }, + "Dawson_Creek": { + "exemplarCity": "Dawson Creek" + }, + "Denver": { + "exemplarCity": "Denver" + }, + "Detroit": { + "exemplarCity": "Detroit" + }, + "Dominica": { + "exemplarCity": "Dominika" + }, + "Edmonton": { + "exemplarCity": "Edmonton" + }, + "Eirunepe": { + "exemplarCity": "Eirunepe" + }, + "El_Salvador": { + "exemplarCity": "Salwador" + }, + "Fort_Nelson": { + "exemplarCity": "Fort Nelson" + }, + "Fortaleza": { + "exemplarCity": "Fortaleza" + }, + "Glace_Bay": { + "exemplarCity": "Glace Bay" + }, + "Godthab": { + "exemplarCity": "Nuuk" + }, + "Goose_Bay": { + "exemplarCity": "Goose Bay" + }, + "Grand_Turk": { + "exemplarCity": "Grand Turk" + }, + "Grenada": { + "exemplarCity": "Grenada" + }, + "Guadeloupe": { + "exemplarCity": "Gwadelupa" + }, + "Guatemala": { + "exemplarCity": "Gwatemala" + }, + "Guayaquil": { + "exemplarCity": "Guayaquil" + }, + "Guyana": { + "exemplarCity": "Gujana" + }, + "Halifax": { + "exemplarCity": "Halifax" + }, + "Havana": { + "exemplarCity": "Hawana" + }, + "Hermosillo": { + "exemplarCity": "Hermosillo" + }, + "Indiana": { + "Vincennes": { + "exemplarCity": "Vincennes, Indiana" + }, + "Petersburg": { + "exemplarCity": "Petersburg, Indiana" + }, + "Tell_City": { + "exemplarCity": "Tell City, Indiana" + }, + "Knox": { + "exemplarCity": "Knox, Indiana" + }, + "Winamac": { + "exemplarCity": "Winamac, Indiana" + }, + "Marengo": { + "exemplarCity": "Marengo, Indiana" + }, + "Vevay": { + "exemplarCity": "Vevay, Indiana" + } + }, + "Indianapolis": { + "exemplarCity": "Indianapolis" + }, + "Inuvik": { + "exemplarCity": "Inuvik" + }, + "Iqaluit": { + "exemplarCity": "Iqaluit" + }, + "Jamaica": { + "exemplarCity": "Jamajka" + }, + "Jujuy": { + "exemplarCity": "Jujuy" + }, + "Juneau": { + "exemplarCity": "Juneau" + }, + "Kentucky": { + "Monticello": { + "exemplarCity": "Monticello" + } + }, + "Kralendijk": { + "exemplarCity": "Kralendijk" + }, + "La_Paz": { + "exemplarCity": "La Paz" + }, + "Lima": { + "exemplarCity": "Lima" + }, + "Los_Angeles": { + "exemplarCity": "Los Angeles" + }, + "Louisville": { + "exemplarCity": "Louisville" + }, + "Lower_Princes": { + "exemplarCity": "Lower Prince’s Quarter" + }, + "Maceio": { + "exemplarCity": "Maceió" + }, + "Managua": { + "exemplarCity": "Managua" + }, + "Manaus": { + "exemplarCity": "Manaus" + }, + "Marigot": { + "exemplarCity": "Marigot" + }, + "Martinique": { + "exemplarCity": "Martynika" + }, + "Matamoros": { + "exemplarCity": "Matamoros" + }, + "Mazatlan": { + "exemplarCity": "Mazatlan" + }, + "Mendoza": { + "exemplarCity": "Mendoza" + }, + "Menominee": { + "exemplarCity": "Menominee" + }, + "Merida": { + "exemplarCity": "Merida" + }, + "Metlakatla": { + "exemplarCity": "Metlakatla" + }, + "Mexico_City": { + "exemplarCity": "Meksyk (miasto)" + }, + "Miquelon": { + "exemplarCity": "Miquelon" + }, + "Moncton": { + "exemplarCity": "Moncton" + }, + "Monterrey": { + "exemplarCity": "Monterrey" + }, + "Montevideo": { + "exemplarCity": "Montevideo" + }, + "Montserrat": { + "exemplarCity": "Montserrat" + }, + "Nassau": { + "exemplarCity": "Nassau" + }, + "New_York": { + "exemplarCity": "Nowy Jork" + }, + "Nipigon": { + "exemplarCity": "Nipigon" + }, + "Nome": { + "exemplarCity": "Nome" + }, + "Noronha": { + "exemplarCity": "Noronha" + }, + "North_Dakota": { + "Beulah": { + "exemplarCity": "Beulah, Dakota Północna" + }, + "New_Salem": { + "exemplarCity": "New Salem, Dakota Północna" + }, + "Center": { + "exemplarCity": "Center, Dakota Północna" + } + }, + "Ojinaga": { + "exemplarCity": "Ojinaga" + }, + "Panama": { + "exemplarCity": "Panama" + }, + "Pangnirtung": { + "exemplarCity": "Pangnirtung" + }, + "Paramaribo": { + "exemplarCity": "Paramaribo" + }, + "Phoenix": { + "exemplarCity": "Phoenix" + }, + "Port-au-Prince": { + "exemplarCity": "Port-au-Prince" + }, + "Port_of_Spain": { + "exemplarCity": "Port-of-Spain" + }, + "Porto_Velho": { + "exemplarCity": "Porto Velho" + }, + "Puerto_Rico": { + "exemplarCity": "Portoryko" + }, + "Punta_Arenas": { + "exemplarCity": "Punta Arenas" + }, + "Rainy_River": { + "exemplarCity": "Rainy River" + }, + "Rankin_Inlet": { + "exemplarCity": "Rankin Inlet" + }, + "Recife": { + "exemplarCity": "Recife" + }, + "Regina": { + "exemplarCity": "Regina" + }, + "Resolute": { + "exemplarCity": "Resolute" + }, + "Rio_Branco": { + "exemplarCity": "Rio Branco" + }, + "Santa_Isabel": { + "exemplarCity": "Santa Isabel" + }, + "Santarem": { + "exemplarCity": "Santarem" + }, + "Santiago": { + "exemplarCity": "Santiago" + }, + "Santo_Domingo": { + "exemplarCity": "Santo Domingo" + }, + "Sao_Paulo": { + "exemplarCity": "Sao Paulo" + }, + "Scoresbysund": { + "exemplarCity": "Ittoqqortoormiit" + }, + "Sitka": { + "exemplarCity": "Sitka" + }, + "St_Barthelemy": { + "exemplarCity": "Saint-Barthélemy" + }, + "St_Johns": { + "exemplarCity": "St. John’s" + }, + "St_Kitts": { + "exemplarCity": "Saint Kitts" + }, + "St_Lucia": { + "exemplarCity": "Saint Lucia" + }, + "St_Thomas": { + "exemplarCity": "Saint Thomas" + }, + "St_Vincent": { + "exemplarCity": "Saint Vincent" + }, + "Swift_Current": { + "exemplarCity": "Swift Current" + }, + "Tegucigalpa": { + "exemplarCity": "Tegucigalpa" + }, + "Thule": { + "exemplarCity": "Qaanaaq" + }, + "Thunder_Bay": { + "exemplarCity": "Thunder Bay" + }, + "Tijuana": { + "exemplarCity": "Tijuana" + }, + "Toronto": { + "exemplarCity": "Toronto" + }, + "Tortola": { + "exemplarCity": "Tortola" + }, + "Vancouver": { + "exemplarCity": "Vancouver" + }, + "Whitehorse": { + "exemplarCity": "Whitehorse" + }, + "Winnipeg": { + "exemplarCity": "Winnipeg" + }, + "Yakutat": { + "exemplarCity": "Yakutat" + }, + "Yellowknife": { + "exemplarCity": "Yellowknife" + } + }, + "Atlantic": { + "Azores": { + "exemplarCity": "Azory" + }, + "Bermuda": { + "exemplarCity": "Bermudy" + }, + "Canary": { + "exemplarCity": "Wyspy Kanaryjskie" + }, + "Cape_Verde": { + "exemplarCity": "Republika Zielonego Przylądka" + }, + "Faeroe": { + "exemplarCity": "Wyspy Owcze" + }, + "Madeira": { + "exemplarCity": "Madera" + }, + "Reykjavik": { + "exemplarCity": "Reykjavik" + }, + "South_Georgia": { + "exemplarCity": "Georgia Południowa" + }, + "St_Helena": { + "exemplarCity": "Święta Helena" + }, + "Stanley": { + "exemplarCity": "Stanley" + } + }, + "Europe": { + "Amsterdam": { + "exemplarCity": "Amsterdam" + }, + "Andorra": { + "exemplarCity": "Andora" + }, + "Astrakhan": { + "exemplarCity": "Astrachań" + }, + "Athens": { + "exemplarCity": "Ateny" + }, + "Belgrade": { + "exemplarCity": "Belgrad" + }, + "Berlin": { + "exemplarCity": "Berlin" + }, + "Bratislava": { + "exemplarCity": "Bratysława" + }, + "Brussels": { + "exemplarCity": "Bruksela" + }, + "Bucharest": { + "exemplarCity": "Bukareszt" + }, + "Budapest": { + "exemplarCity": "Budapeszt" + }, + "Busingen": { + "exemplarCity": "Büsingen am Hochrhein" + }, + "Chisinau": { + "exemplarCity": "Kiszyniów" + }, + "Copenhagen": { + "exemplarCity": "Kopenhaga" + }, + "Dublin": { + "long": { + "daylight": "Irlandia (czas letni)" + }, + "exemplarCity": "Dublin" + }, + "Gibraltar": { + "exemplarCity": "Gibraltar" + }, + "Guernsey": { + "exemplarCity": "Guernsey" + }, + "Helsinki": { + "exemplarCity": "Helsinki" + }, + "Isle_of_Man": { + "exemplarCity": "Wyspa Man" + }, + "Istanbul": { + "exemplarCity": "Stambuł" + }, + "Jersey": { + "exemplarCity": "Jersey" + }, + "Kaliningrad": { + "exemplarCity": "Kaliningrad" + }, + "Kiev": { + "exemplarCity": "Kijów" + }, + "Kirov": { + "exemplarCity": "Kirow" + }, + "Lisbon": { + "exemplarCity": "Lizbona" + }, + "Ljubljana": { + "exemplarCity": "Lublana" + }, + "London": { + "long": { + "daylight": "Brytyjski czas letni" + }, + "exemplarCity": "Londyn" + }, + "Luxembourg": { + "exemplarCity": "Luksemburg" + }, + "Madrid": { + "exemplarCity": "Madryt" + }, + "Malta": { + "exemplarCity": "Malta" + }, + "Mariehamn": { + "exemplarCity": "Maarianhamina" + }, + "Minsk": { + "exemplarCity": "Mińsk" + }, + "Monaco": { + "exemplarCity": "Monako" + }, + "Moscow": { + "exemplarCity": "Moskwa" + }, + "Oslo": { + "exemplarCity": "Oslo" + }, + "Paris": { + "exemplarCity": "Paryż" + }, + "Podgorica": { + "exemplarCity": "Podgorica" + }, + "Prague": { + "exemplarCity": "Praga" + }, + "Riga": { + "exemplarCity": "Ryga" + }, + "Rome": { + "exemplarCity": "Rzym" + }, + "Samara": { + "exemplarCity": "Samara" + }, + "San_Marino": { + "exemplarCity": "San Marino" + }, + "Sarajevo": { + "exemplarCity": "Sarajewo" + }, + "Saratov": { + "exemplarCity": "Saratów" + }, + "Simferopol": { + "exemplarCity": "Symferopol" + }, + "Skopje": { + "exemplarCity": "Skopje" + }, + "Sofia": { + "exemplarCity": "Sofia" + }, + "Stockholm": { + "exemplarCity": "Sztokholm" + }, + "Tallinn": { + "exemplarCity": "Tallin" + }, + "Tirane": { + "exemplarCity": "Tirana" + }, + "Ulyanovsk": { + "exemplarCity": "Uljanowsk" + }, + "Uzhgorod": { + "exemplarCity": "Użgorod" + }, + "Vaduz": { + "exemplarCity": "Vaduz" + }, + "Vatican": { + "exemplarCity": "Watykan" + }, + "Vienna": { + "exemplarCity": "Wiedeń" + }, + "Vilnius": { + "exemplarCity": "Wilno" + }, + "Volgograd": { + "exemplarCity": "Wołgograd" + }, + "Warsaw": { + "exemplarCity": "Warszawa" + }, + "Zagreb": { + "exemplarCity": "Zagrzeb" + }, + "Zaporozhye": { + "exemplarCity": "Zaporoże" + }, + "Zurich": { + "exemplarCity": "Zurych" + } + }, + "Africa": { + "Abidjan": { + "exemplarCity": "Abidżan" + }, + "Accra": { + "exemplarCity": "Akra" + }, + "Addis_Ababa": { + "exemplarCity": "Addis Abeba" + }, + "Algiers": { + "exemplarCity": "Algier" + }, + "Asmera": { + "exemplarCity": "Asmara" + }, + "Bamako": { + "exemplarCity": "Bamako" + }, + "Bangui": { + "exemplarCity": "Bangi" + }, + "Banjul": { + "exemplarCity": "Bandżul" + }, + "Bissau": { + "exemplarCity": "Bissau" + }, + "Blantyre": { + "exemplarCity": "Blantyre" + }, + "Brazzaville": { + "exemplarCity": "Brazzaville" + }, + "Bujumbura": { + "exemplarCity": "Bużumbura" + }, + "Cairo": { + "exemplarCity": "Kair" + }, + "Casablanca": { + "exemplarCity": "Casablanca" + }, + "Ceuta": { + "exemplarCity": "Ceuta" + }, + "Conakry": { + "exemplarCity": "Konakry" + }, + "Dakar": { + "exemplarCity": "Dakar" + }, + "Dar_es_Salaam": { + "exemplarCity": "Dar es Salaam" + }, + "Djibouti": { + "exemplarCity": "Dżibuti" + }, + "Douala": { + "exemplarCity": "Duala" + }, + "El_Aaiun": { + "exemplarCity": "Al-Ujun" + }, + "Freetown": { + "exemplarCity": "Freetown" + }, + "Gaborone": { + "exemplarCity": "Gaborone" + }, + "Harare": { + "exemplarCity": "Harare" + }, + "Johannesburg": { + "exemplarCity": "Johannesburg" + }, + "Juba": { + "exemplarCity": "Dżuba" + }, + "Kampala": { + "exemplarCity": "Kampala" + }, + "Khartoum": { + "exemplarCity": "Chartum" + }, + "Kigali": { + "exemplarCity": "Kigali" + }, + "Kinshasa": { + "exemplarCity": "Kinszasa" + }, + "Lagos": { + "exemplarCity": "Lagos" + }, + "Libreville": { + "exemplarCity": "Libreville" + }, + "Lome": { + "exemplarCity": "Lomé" + }, + "Luanda": { + "exemplarCity": "Luanda" + }, + "Lubumbashi": { + "exemplarCity": "Lubumbashi" + }, + "Lusaka": { + "exemplarCity": "Lusaka" + }, + "Malabo": { + "exemplarCity": "Malabo" + }, + "Maputo": { + "exemplarCity": "Maputo" + }, + "Maseru": { + "exemplarCity": "Maseru" + }, + "Mbabane": { + "exemplarCity": "Mbabane" + }, + "Mogadishu": { + "exemplarCity": "Mogadiszu" + }, + "Monrovia": { + "exemplarCity": "Monrovia" + }, + "Nairobi": { + "exemplarCity": "Nairobi" + }, + "Ndjamena": { + "exemplarCity": "Ndżamena" + }, + "Niamey": { + "exemplarCity": "Niamey" + }, + "Nouakchott": { + "exemplarCity": "Nawakszut" + }, + "Ouagadougou": { + "exemplarCity": "Wagadugu" + }, + "Porto-Novo": { + "exemplarCity": "Porto Novo" + }, + "Sao_Tome": { + "exemplarCity": "São Tomé" + }, + "Tripoli": { + "exemplarCity": "Trypolis" + }, + "Tunis": { + "exemplarCity": "Tunis" + }, + "Windhoek": { + "exemplarCity": "Windhuk" + } + }, + "Asia": { + "Aden": { + "exemplarCity": "Aden" + }, + "Almaty": { + "exemplarCity": "Ałmaty" + }, + "Amman": { + "exemplarCity": "Amman" + }, + "Anadyr": { + "exemplarCity": "Anadyr" + }, + "Aqtau": { + "exemplarCity": "Aktau" + }, + "Aqtobe": { + "exemplarCity": "Aktiubińsk" + }, + "Ashgabat": { + "exemplarCity": "Aszchabad" + }, + "Atyrau": { + "exemplarCity": "Atyrau" + }, + "Baghdad": { + "exemplarCity": "Bagdad" + }, + "Bahrain": { + "exemplarCity": "Bahrajn" + }, + "Baku": { + "exemplarCity": "Baku" + }, + "Bangkok": { + "exemplarCity": "Bangkok" + }, + "Barnaul": { + "exemplarCity": "Barnauł" + }, + "Beirut": { + "exemplarCity": "Bejrut" + }, + "Bishkek": { + "exemplarCity": "Biszkek" + }, + "Brunei": { + "exemplarCity": "Brunei" + }, + "Calcutta": { + "exemplarCity": "Kalkuta" + }, + "Chita": { + "exemplarCity": "Czyta" + }, + "Choibalsan": { + "exemplarCity": "Czojbalsan" + }, + "Colombo": { + "exemplarCity": "Kolombo" + }, + "Damascus": { + "exemplarCity": "Damaszek" + }, + "Dhaka": { + "exemplarCity": "Dhaka" + }, + "Dili": { + "exemplarCity": "Dili" + }, + "Dubai": { + "exemplarCity": "Dubaj" + }, + "Dushanbe": { + "exemplarCity": "Duszanbe" + }, + "Famagusta": { + "exemplarCity": "Famagusta" + }, + "Gaza": { + "exemplarCity": "Gaza" + }, + "Hebron": { + "exemplarCity": "Hebron" + }, + "Hong_Kong": { + "exemplarCity": "Hongkong" + }, + "Hovd": { + "exemplarCity": "Kobdo" + }, + "Irkutsk": { + "exemplarCity": "Irkuck" + }, + "Jakarta": { + "exemplarCity": "Dżakarta" + }, + "Jayapura": { + "exemplarCity": "Jayapura" + }, + "Jerusalem": { + "exemplarCity": "Jerozolima" + }, + "Kabul": { + "exemplarCity": "Kabul" + }, + "Kamchatka": { + "exemplarCity": "Kamczatka" + }, + "Karachi": { + "exemplarCity": "Karaczi" + }, + "Katmandu": { + "exemplarCity": "Katmandu" + }, + "Khandyga": { + "exemplarCity": "Chandyga" + }, + "Krasnoyarsk": { + "exemplarCity": "Krasnojarsk" + }, + "Kuala_Lumpur": { + "exemplarCity": "Kuala Lumpur" + }, + "Kuching": { + "exemplarCity": "Kuching" + }, + "Kuwait": { + "exemplarCity": "Kuwejt" + }, + "Macau": { + "exemplarCity": "Makau" + }, + "Magadan": { + "exemplarCity": "Magadan" + }, + "Makassar": { + "exemplarCity": "Makassar" + }, + "Manila": { + "exemplarCity": "Manila" + }, + "Muscat": { + "exemplarCity": "Maskat" + }, + "Nicosia": { + "exemplarCity": "Nikozja" + }, + "Novokuznetsk": { + "exemplarCity": "Nowokuźnieck" + }, + "Novosibirsk": { + "exemplarCity": "Nowosybirsk" + }, + "Omsk": { + "exemplarCity": "Omsk" + }, + "Oral": { + "exemplarCity": "Uralsk" + }, + "Phnom_Penh": { + "exemplarCity": "Phnom Penh" + }, + "Pontianak": { + "exemplarCity": "Pontianak" + }, + "Pyongyang": { + "exemplarCity": "Pjongjang" + }, + "Qatar": { + "exemplarCity": "Katar" + }, + "Qostanay": { + "exemplarCity": "Kustanaj" + }, + "Qyzylorda": { + "exemplarCity": "Kyzyłorda" + }, + "Rangoon": { + "exemplarCity": "Rangun" + }, + "Riyadh": { + "exemplarCity": "Rijad" + }, + "Saigon": { + "exemplarCity": "Ho Chi Minh" + }, + "Sakhalin": { + "exemplarCity": "Sachalin" + }, + "Samarkand": { + "exemplarCity": "Samarkanda" + }, + "Seoul": { + "exemplarCity": "Seul" + }, + "Shanghai": { + "exemplarCity": "Szanghaj" + }, + "Singapore": { + "exemplarCity": "Singapur" + }, + "Srednekolymsk": { + "exemplarCity": "Sriedniekołymsk" + }, + "Taipei": { + "exemplarCity": "Tajpej" + }, + "Tashkent": { + "exemplarCity": "Taszkient" + }, + "Tbilisi": { + "exemplarCity": "Tbilisi" + }, + "Tehran": { + "exemplarCity": "Teheran" + }, + "Thimphu": { + "exemplarCity": "Thimphu" + }, + "Tokyo": { + "exemplarCity": "Tokio" + }, + "Tomsk": { + "exemplarCity": "Tomsk" + }, + "Ulaanbaatar": { + "exemplarCity": "Ułan Bator" + }, + "Urumqi": { + "exemplarCity": "Urumczi" + }, + "Ust-Nera": { + "exemplarCity": "Ust-Niera" + }, + "Vientiane": { + "exemplarCity": "Wientian" + }, + "Vladivostok": { + "exemplarCity": "Władywostok" + }, + "Yakutsk": { + "exemplarCity": "Jakuck" + }, + "Yekaterinburg": { + "exemplarCity": "Jekaterynburg" + }, + "Yerevan": { + "exemplarCity": "Erywań" + } + }, + "Indian": { + "Antananarivo": { + "exemplarCity": "Antananarywa" + }, + "Chagos": { + "exemplarCity": "Czagos" + }, + "Christmas": { + "exemplarCity": "Wyspa Bożego Narodzenia" + }, + "Cocos": { + "exemplarCity": "Wyspy Kokosowe" + }, + "Comoro": { + "exemplarCity": "Komory" + }, + "Kerguelen": { + "exemplarCity": "Wyspy Kerguelena" + }, + "Mahe": { + "exemplarCity": "Mahé" + }, + "Maldives": { + "exemplarCity": "Malediwy" + }, + "Mauritius": { + "exemplarCity": "Mauritius" + }, + "Mayotte": { + "exemplarCity": "Majotta" + }, + "Reunion": { + "exemplarCity": "Réunion" + } + }, + "Australia": { + "Adelaide": { + "exemplarCity": "Adelaide" + }, + "Brisbane": { + "exemplarCity": "Brisbane" + }, + "Broken_Hill": { + "exemplarCity": "Broken Hill" + }, + "Currie": { + "exemplarCity": "Currie" + }, + "Darwin": { + "exemplarCity": "Darwin" + }, + "Eucla": { + "exemplarCity": "Eucla" + }, + "Hobart": { + "exemplarCity": "Hobart" + }, + "Lindeman": { + "exemplarCity": "Lindeman" + }, + "Lord_Howe": { + "exemplarCity": "Lord Howe" + }, + "Melbourne": { + "exemplarCity": "Melbourne" + }, + "Perth": { + "exemplarCity": "Perth" + }, + "Sydney": { + "exemplarCity": "Sydney" + } + }, + "Pacific": { + "Apia": { + "exemplarCity": "Apia" + }, + "Auckland": { + "exemplarCity": "Auckland" + }, + "Bougainville": { + "exemplarCity": "Wyspa Bougainville’a" + }, + "Chatham": { + "exemplarCity": "Chatham" + }, + "Easter": { + "exemplarCity": "Wyspa Wielkanocna" + }, + "Efate": { + "exemplarCity": "Efate" + }, + "Enderbury": { + "exemplarCity": "Enderbury" + }, + "Fakaofo": { + "exemplarCity": "Fakaofo" + }, + "Fiji": { + "exemplarCity": "Fidżi" + }, + "Funafuti": { + "exemplarCity": "Funafuti" + }, + "Galapagos": { + "exemplarCity": "Galapagos" + }, + "Gambier": { + "exemplarCity": "Wyspy Gambiera" + }, + "Guadalcanal": { + "exemplarCity": "Guadalcanal" + }, + "Guam": { + "exemplarCity": "Guam" + }, + "Honolulu": { + "exemplarCity": "Honolulu" + }, + "Johnston": { + "exemplarCity": "Johnston" + }, + "Kiritimati": { + "exemplarCity": "Kiritimati" + }, + "Kosrae": { + "exemplarCity": "Kosrae" + }, + "Kwajalein": { + "exemplarCity": "Kwajalein" + }, + "Majuro": { + "exemplarCity": "Majuro" + }, + "Marquesas": { + "exemplarCity": "Markizy" + }, + "Midway": { + "exemplarCity": "Midway" + }, + "Nauru": { + "exemplarCity": "Nauru" + }, + "Niue": { + "exemplarCity": "Niue" + }, + "Norfolk": { + "exemplarCity": "Norfolk" + }, + "Noumea": { + "exemplarCity": "Numea" + }, + "Pago_Pago": { + "exemplarCity": "Pago Pago" + }, + "Palau": { + "exemplarCity": "Palau" + }, + "Pitcairn": { + "exemplarCity": "Pitcairn" + }, + "Ponape": { + "exemplarCity": "Pohnpei" + }, + "Port_Moresby": { + "exemplarCity": "Port Moresby" + }, + "Rarotonga": { + "exemplarCity": "Rarotonga" + }, + "Saipan": { + "exemplarCity": "Saipan" + }, + "Tahiti": { + "exemplarCity": "Tahiti" + }, + "Tarawa": { + "exemplarCity": "Tarawa" + }, + "Tongatapu": { + "exemplarCity": "Tongatapu" + }, + "Truk": { + "exemplarCity": "Chuuk" + }, + "Wake": { + "exemplarCity": "Wake" + }, + "Wallis": { + "exemplarCity": "Wallis" + } + }, + "Arctic": { + "Longyearbyen": { + "exemplarCity": "Longyearbyen" + } + }, + "Antarctica": { + "Casey": { + "exemplarCity": "Casey" + }, + "Davis": { + "exemplarCity": "Davis" + }, + "DumontDUrville": { + "exemplarCity": "Dumont d’Urville" + }, + "Macquarie": { + "exemplarCity": "Macquarie" + }, + "Mawson": { + "exemplarCity": "Mawson" + }, + "McMurdo": { + "exemplarCity": "McMurdo" + }, + "Palmer": { + "exemplarCity": "Palmer" + }, + "Rothera": { + "exemplarCity": "Rothera" + }, + "Syowa": { + "exemplarCity": "Syowa" + }, + "Troll": { + "exemplarCity": "Troll" + }, + "Vostok": { + "exemplarCity": "Wostok" + } + }, + "Etc": { + "UTC": { + "long": { + "standard": "uniwersalny czas koordynowany" + }, + "short": { + "standard": "UTC" + } + }, + "Unknown": { + "exemplarCity": "Nieznane miasto" + } + } + }, + "metazone": { + "Afghanistan": { + "long": { + "standard": "Afganistan" + } + }, + "Africa_Central": { + "long": { + "standard": "czas środkowoafrykański" + } + }, + "Africa_Eastern": { + "long": { + "standard": "czas wschodnioafrykański" + } + }, + "Africa_Southern": { + "long": { + "standard": "czas południowoafrykański" + } + }, + "Africa_Western": { + "long": { + "generic": "czas zachodnioafrykański", + "standard": "czas zachodnioafrykański standardowy", + "daylight": "czas zachodnioafrykański letni" + } + }, + "Alaska": { + "long": { + "generic": "czas Alaska", + "standard": "Alaska (czas standardowy)", + "daylight": "Alaska (czas letni)" + } + }, + "Amazon": { + "long": { + "generic": "czas amazoński", + "standard": "czas amazoński standardowy", + "daylight": "czas amazoński letni" + } + }, + "America_Central": { + "long": { + "generic": "czas środkowoamerykański", + "standard": "czas środkowoamerykański standardowy", + "daylight": "czas środkowoamerykański letni" + } + }, + "America_Eastern": { + "long": { + "generic": "czas wschodnioamerykański", + "standard": "czas wschodnioamerykański standardowy", + "daylight": "czas wschodnioamerykański letni" + } + }, + "America_Mountain": { + "long": { + "generic": "czas górski", + "standard": "czas górski standardowy", + "daylight": "czas górski letni" + } + }, + "America_Pacific": { + "long": { + "generic": "czas pacyficzny", + "standard": "czas pacyficzny standardowy", + "daylight": "czas pacyficzny letni" + } + }, + "Anadyr": { + "long": { + "generic": "czas Anadyr", + "standard": "czas standardowy Anadyr", + "daylight": "czas Anadyr letni" + } + }, + "Apia": { + "long": { + "generic": "czas Apia", + "standard": "Apia (czas standardowy)", + "daylight": "Apia (czas letni)" + } + }, + "Arabian": { + "long": { + "generic": "czas Półwysep Arabski", + "standard": "Półwysep Arabski (czas standardowy)", + "daylight": "Półwysep Arabski (czas letni)" + } + }, + "Argentina": { + "long": { + "generic": "czas Argentyna", + "standard": "Argentyna (czas standardowy)", + "daylight": "Argentyna (czas letni)" + } + }, + "Argentina_Western": { + "long": { + "generic": "czas Argentyna Zachodnia", + "standard": "Argentyna Zachodnia (czas standardowy)", + "daylight": "Argentyna Zachodnia (czas letni)" + } + }, + "Armenia": { + "long": { + "generic": "czas Armenia", + "standard": "Armenia (czas standardowy)", + "daylight": "Armenia (czas letni)" + } + }, + "Atlantic": { + "long": { + "generic": "czas atlantycki", + "standard": "czas atlantycki standardowy", + "daylight": "czas atlantycki letni" + } + }, + "Australia_Central": { + "long": { + "generic": "czas środkowoaustralijski", + "standard": "czas środkowoaustralijski standardowy", + "daylight": "czas środkowoaustralijski letni" + } + }, + "Australia_CentralWestern": { + "long": { + "generic": "czas środkowo-zachodnioaustralijski", + "standard": "czas środkowo-zachodnioaustralijski standardowy", + "daylight": "czas środkowo-zachodnioaustralijski letni" + } + }, + "Australia_Eastern": { + "long": { + "generic": "czas wschodnioaustralijski", + "standard": "czas wschodnioaustralijski standardowy", + "daylight": "czas wschodnioaustralijski letni" + } + }, + "Australia_Western": { + "long": { + "generic": "czas zachodnioaustralijski", + "standard": "czas zachodnioaustralijski standardowy", + "daylight": "czas zachodnioaustralijski letni" + } + }, + "Azerbaijan": { + "long": { + "generic": "czas Azerbejdżan", + "standard": "Azerbejdżan (czas standardowy)", + "daylight": "Azerbejdżan (czas letni)" + } + }, + "Azores": { + "long": { + "generic": "czas Azory", + "standard": "Azory (czas standardowy)", + "daylight": "Azory (czas letni)" + } + }, + "Bangladesh": { + "long": { + "generic": "czas Bangladesz", + "standard": "Bangladesz (czas standardowy)", + "daylight": "Bangladesz (czas letni)" + } + }, + "Bolivia": { + "long": { + "standard": "czas Boliwia" + } + }, + "Brasilia": { + "long": { + "generic": "czas Brasília", + "standard": "Brasília (czas standardowy)", + "daylight": "Brasília (czas letni)" + } + }, + "Cape_Verde": { + "long": { + "generic": "czas Wyspy Zielonego Przylądka", + "standard": "Wyspy Zielonego Przylądka (czas standardowy)", + "daylight": "Wyspy Zielonego Przylądka (czas letni)" + } + }, + "Chamorro": { + "long": { + "standard": "czas Czamorro" + } + }, + "Chatham": { + "long": { + "generic": "czas Chatham", + "standard": "Chatham (czas standardowy)", + "daylight": "Chatham (czas letni)" + } + }, + "Chile": { + "long": { + "generic": "czas Chile", + "standard": "Chile (czas standardowy)", + "daylight": "Chile (czas letni)" + } + }, + "China": { + "long": { + "generic": "czas Chiny", + "standard": "Chiny (czas standardowy)", + "daylight": "Chiny (czas letni)" + } + }, + "Choibalsan": { + "long": { + "generic": "czas Czojbalsan", + "standard": "Czojbalsan (czas standardowy)", + "daylight": "Czojbalsan (czas letni)" + } + }, + "Christmas": { + "long": { + "standard": "czas Wyspa Bożego Narodzenia" + } + }, + "Cocos": { + "long": { + "standard": "czas Wyspy Kokosowe" + } + }, + "Colombia": { + "long": { + "generic": "czas Kolumbia", + "standard": "Kolumbia (czas standardowy)", + "daylight": "Kolumbia (czas letni)" + } + }, + "Cook": { + "long": { + "generic": "czas Wyspy Cooka", + "standard": "Wyspy Cooka (czas standardowy)", + "daylight": "Wyspy Cooka (czas letni)" + } + }, + "Cuba": { + "long": { + "generic": "czas Kuba", + "standard": "Kuba (czas standardowy)", + "daylight": "Kuba (czas letni)" + } + }, + "DumontDUrville": { + "long": { + "standard": "czas Dumont-d’Urville" + } + }, + "East_Timor": { + "long": { + "standard": "czas Timor Wschodni" + } + }, + "Easter": { + "long": { + "generic": "czas Wyspa Wielkanocna", + "standard": "Wyspa Wielkanocna (czas standardowy)", + "daylight": "Wyspa Wielkanocna (czas letni)" + } + }, + "Ecuador": { + "long": { + "standard": "czas Ekwador" + } + }, + "Europe_Central": { + "long": { + "generic": "czas środkowoeuropejski", + "standard": "czas środkowoeuropejski standardowy", + "daylight": "czas środkowoeuropejski letni" + }, + "short": { + "generic": "CET", + "standard": "CET", + "daylight": "CEST" + } + }, + "Europe_Eastern": { + "long": { + "generic": "czas wschodnioeuropejski", + "standard": "czas wschodnioeuropejski standardowy", + "daylight": "czas wschodnioeuropejski letni" + }, + "short": { + "generic": "EET", + "standard": "EET", + "daylight": "EEST" + } + }, + "Europe_Further_Eastern": { + "long": { + "standard": "czas wschodnioeuropejski dalszy" + } + }, + "Europe_Western": { + "long": { + "generic": "czas zachodnioeuropejski", + "standard": "czas zachodnioeuropejski standardowy", + "daylight": "czas zachodnioeuropejski letni" + }, + "short": { + "generic": "WET", + "standard": "WET", + "daylight": "WEST" + } + }, + "Falkland": { + "long": { + "generic": "czas Falklandy", + "standard": "Falklandy (czas standardowy)", + "daylight": "Falklandy (czas letni)" + } + }, + "Fiji": { + "long": { + "generic": "czas Fidżi", + "standard": "Fidżi (czas standardowy)", + "daylight": "Fidżi (czas letni)" + } + }, + "French_Guiana": { + "long": { + "standard": "czas Gujana Francuska" + } + }, + "French_Southern": { + "long": { + "standard": "czas Francuskie Terytoria Południowe i Antarktyczne" + } + }, + "Gambier": { + "long": { + "standard": "czas Wyspy Gambiera" + } + }, + "Georgia": { + "long": { + "generic": "czas Gruzja", + "standard": "Gruzja (czas standardowy)", + "daylight": "Gruzja (czas letni)" + } + }, + "Gilbert_Islands": { + "long": { + "standard": "czas Wyspy Gilberta" + } + }, + "GMT": { + "long": { + "standard": "czas uniwersalny" + } + }, + "Greenland_Eastern": { + "long": { + "generic": "czas Grenlandia Wschodnia", + "standard": "Grenlandia Wschodnia (czas standardowy)", + "daylight": "Grenlandia Wschodnia (czas letni)" + } + }, + "Greenland_Western": { + "long": { + "generic": "czas Grenlandia Zachodnia", + "standard": "Grenlandia Zachodnia (czas standardowy)", + "daylight": "Grenlandia Zachodnia (czas letni)" + } + }, + "Gulf": { + "long": { + "standard": "czas Zatoka Perska" + } + }, + "Guyana": { + "long": { + "standard": "czas Gujana" + } + }, + "Hawaii_Aleutian": { + "long": { + "generic": "czas Hawaje-Aleuty", + "standard": "Hawaje-Aleuty (czas standardowy)", + "daylight": "Hawaje-Aleuty (czas letni)" + } + }, + "Hong_Kong": { + "long": { + "generic": "czas Hongkong", + "standard": "Hongkong (czas standardowy)", + "daylight": "Hongkong (czas letni)" + } + }, + "Hovd": { + "long": { + "generic": "czas Kobdo", + "standard": "Kobdo (czas standardowy)", + "daylight": "Kobdo (czas letni)" + } + }, + "India": { + "long": { + "standard": "czas indyjski standardowy" + } + }, + "Indian_Ocean": { + "long": { + "standard": "czas Ocean Indyjski" + } + }, + "Indochina": { + "long": { + "standard": "czas indochiński" + } + }, + "Indonesia_Central": { + "long": { + "standard": "czas Indonezja Środkowa" + } + }, + "Indonesia_Eastern": { + "long": { + "standard": "czas Indonezja Wschodnia" + } + }, + "Indonesia_Western": { + "long": { + "standard": "czas Indonezja Zachodnia" + } + }, + "Iran": { + "long": { + "generic": "czas Iran", + "standard": "Iran (czas standardowy)", + "daylight": "Iran (czas letni)" + } + }, + "Irkutsk": { + "long": { + "generic": "czas Irkuck", + "standard": "Irkuck (czas standardowy)", + "daylight": "Irkuck (czas letni)" + } + }, + "Israel": { + "long": { + "generic": "czas Izrael", + "standard": "Izrael (czas standardowy)", + "daylight": "Izrael (czas letni)" + } + }, + "Japan": { + "long": { + "generic": "czas Japonia", + "standard": "Japonia (czas standardowy)", + "daylight": "Japonia (czas letni)" + } + }, + "Kamchatka": { + "long": { + "generic": "czas Pietropawłowsk Kamczacki", + "standard": "czas standardowy Pietropawłowsk Kamczacki", + "daylight": "czas Pietropawłowsk Kamczacki letni" + } + }, + "Kazakhstan_Eastern": { + "long": { + "standard": "czas Kazachstan Wschodni" + } + }, + "Kazakhstan_Western": { + "long": { + "standard": "czas Kazachstan Zachodni" + } + }, + "Korea": { + "long": { + "generic": "czas Korea", + "standard": "Korea (czas standardowy)", + "daylight": "Korea (czas letni)" + } + }, + "Krasnoyarsk": { + "long": { + "generic": "czas Krasnojarsk", + "standard": "Krasnojarsk (czas standardowy)", + "daylight": "Krasnojarsk (czas letni)" + } + }, + "Kyrgystan": { + "long": { + "standard": "czas Kirgistan" + } + }, + "Line_Islands": { + "long": { + "standard": "czas Line Islands" + } + }, + "Lord_Howe": { + "long": { + "generic": "czas Lord Howe", + "standard": "Lord Howe (czas standardowy)", + "daylight": "Lord Howe (czas letni)" + } + }, + "Magadan": { + "long": { + "generic": "czas Magadan", + "standard": "Magadan (czas standardowy)", + "daylight": "Magadan (czas letni)" + } + }, + "Malaysia": { + "long": { + "standard": "czas Malezja" + } + }, + "Maldives": { + "long": { + "standard": "czas Malediwy" + } + }, + "Marquesas": { + "long": { + "standard": "czas Markizy" + } + }, + "Marshall_Islands": { + "long": { + "standard": "czas Wyspy Marshalla" + } + }, + "Mauritius": { + "long": { + "generic": "czas Mauritius", + "standard": "Mauritius (czas standardowy)", + "daylight": "Mauritius (czas letni)" + } + }, + "Mexico_Northwest": { + "long": { + "generic": "czas Meksyk Północno-Zachodni", + "standard": "Meksyk Północno-Zachodni (czas standardowy)", + "daylight": "Meksyk Północno-Zachodni (czas letni)" + } + }, + "Mexico_Pacific": { + "long": { + "generic": "Meksyk (czas pacyficzny)", + "standard": "Meksyk (czas pacyficzny standardowy)", + "daylight": "Meksyk (czas pacyficzny letni)" + } + }, + "Mongolia": { + "long": { + "generic": "czas Ułan Bator", + "standard": "Ułan Bator (czas standardowy)", + "daylight": "Ułan Bator (czas letni)" + } + }, + "Moscow": { + "long": { + "generic": "czas Moskwa", + "standard": "Moskwa (czas standardowy)", + "daylight": "Moskwa (czas letni)" + } + }, + "Myanmar": { + "long": { + "standard": "czas Mjanma" + } + }, + "New_Caledonia": { + "long": { + "generic": "czas Nowa Kaledonia", + "standard": "Nowa Kaledonia (czas standardowy)", + "daylight": "Nowa Kaledonia (czas letni)" + } + }, + "New_Zealand": { + "long": { + "generic": "czas Nowa Zelandia", + "standard": "Nowa Zelandia (czas standardowy)", + "daylight": "Nowa Zelandia (czas letni)" + } + }, + "Newfoundland": { + "long": { + "generic": "czas Nowa Fundlandia", + "standard": "Nowa Fundlandia (czas standardowy)", + "daylight": "Nowa Fundlandia (czas letni)" + } + }, + "Noronha": { + "long": { + "generic": "czas Fernando de Noronha", + "standard": "Fernando de Noronha (czas standardowy)", + "daylight": "Fernando de Noronha (czas letni)" + } + }, + "Novosibirsk": { + "long": { + "generic": "czas Nowosybirsk", + "standard": "Nowosybirsk (czas standardowy)", + "daylight": "Nowosybirsk (czas letni)" + } + }, + "Omsk": { + "long": { + "generic": "czas Omsk", + "standard": "Omsk (czas standardowy)", + "daylight": "Omsk (czas letni)" + } + }, + "Pakistan": { + "long": { + "generic": "czas Pakistan", + "standard": "Pakistan (czas standardowy)", + "daylight": "Pakistan (czas letni)" + } + }, + "Papua_New_Guinea": { + "long": { + "standard": "czas Papua-Nowa Gwinea" + } + }, + "Paraguay": { + "long": { + "generic": "czas Paragwaj", + "standard": "Paragwaj (czas standardowy)", + "daylight": "Paragwaj (czas letni)" + } + }, + "Peru": { + "long": { + "generic": "czas Peru", + "standard": "Peru (czas standardowy)", + "daylight": "Peru (czas letni)" + } + }, + "Philippines": { + "long": { + "generic": "czas Filipiny", + "standard": "Filipiny (czas standardowy)", + "daylight": "Filipiny (czas letni)" + } + }, + "Phoenix_Islands": { + "long": { + "standard": "czas Feniks" + } + }, + "Pierre_Miquelon": { + "long": { + "generic": "czas Saint-Pierre i Miquelon", + "standard": "Saint-Pierre i Miquelon (czas standardowy)", + "daylight": "Saint-Pierre i Miquelon (czas letni)" + } + }, + "Ponape": { + "long": { + "standard": "czas Pohnpei" + } + }, + "Pyongyang": { + "long": { + "standard": "czas Pjongjang" + } + }, + "Sakhalin": { + "long": { + "generic": "czas Sachalin", + "standard": "Sachalin (czas standardowy)", + "daylight": "Sachalin (czas letni)" + } + }, + "Samara": { + "long": { + "generic": "czas Samara", + "standard": "czas standardowy Samara", + "daylight": "czas Samara letni" + } + }, + "Samoa": { + "long": { + "generic": "czas Samoa", + "standard": "Samoa (czas standardowy)", + "daylight": "Samoa (czas letni)" + } + }, + "Seychelles": { + "long": { + "standard": "czas Seszele" + } + }, + "Singapore": { + "long": { + "standard": "czas Singapur" + } + }, + "Solomon": { + "long": { + "standard": "czas Wyspy Salomona" + } + }, + "South_Georgia": { + "long": { + "standard": "czas Georgia Południowa" + } + }, + "Suriname": { + "long": { + "standard": "czas Surinam" + } + }, + "Taipei": { + "long": { + "generic": "czas Tajpej", + "standard": "Tajpej (czas standardowy)", + "daylight": "Tajpej (czas letni)" + } + }, + "Tajikistan": { + "long": { + "standard": "czas Tadżykistan" + } + }, + "Tonga": { + "long": { + "generic": "czas Tonga", + "standard": "Tonga (czas standardowy)", + "daylight": "Tonga (czas letni)" + } + }, + "Truk": { + "long": { + "standard": "czas Chuuk" + } + }, + "Turkmenistan": { + "long": { + "generic": "czas Turkmenistan", + "standard": "Turkmenistan (czas standardowy)", + "daylight": "Turkmenistan (czas letni)" + } + }, + "Uruguay": { + "long": { + "generic": "czas Urugwaj", + "standard": "Urugwaj (czas standardowy)", + "daylight": "Urugwaj (czas letni)" + } + }, + "Uzbekistan": { + "long": { + "generic": "czas Uzbekistan", + "standard": "Uzbekistan (czas standardowy)", + "daylight": "Uzbekistan (czas letni)" + } + }, + "Vanuatu": { + "long": { + "generic": "czas Vanuatu", + "standard": "Vanuatu (czas standardowy)", + "daylight": "Vanuatu (czas letni)" + } + }, + "Venezuela": { + "long": { + "standard": "czas Wenezuela" + } + }, + "Vladivostok": { + "long": { + "generic": "czas Władywostok", + "standard": "Władywostok (czas standardowy)", + "daylight": "Władywostok (czas letni)" + } + }, + "Volgograd": { + "long": { + "generic": "czas Wołgograd", + "standard": "Wołgograd (czas standardowy)", + "daylight": "Wołgograd (czas letni)" + } + }, + "Vostok": { + "long": { + "standard": "czas Wostok" + } + }, + "Wallis": { + "long": { + "standard": "czas Wallis i Futuna" + } + }, + "Yakutsk": { + "long": { + "generic": "czas Jakuck", + "standard": "Jakuck (czas standardowy)", + "daylight": "Jakuck (czas letni)" + } + }, + "Yekaterinburg": { + "long": { + "generic": "czas Jekaterynburg", + "standard": "Jekaterynburg (czas standardowy)", + "daylight": "Jekaterynburg (czas letni)" + } + } + } + } + } + } + } +} diff --git a/components/datetime/tests/fixtures/data/icu4x/dates/gregory@1/en.json b/components/datetime/tests/fixtures/data/icu4x/dates/gregory@1/en.json new file mode 100644 index 00000000000..62b3151792c --- /dev/null +++ b/components/datetime/tests/fixtures/data/icu4x/dates/gregory@1/en.json @@ -0,0 +1 @@ +{"symbols":{"months":{"format":{"abbreviated":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"narrow":["J","F","M","A","M","J","J","A","S","O","N","D"],"wide":["January","February","March","April","May","June","July","August","September","October","November","December"]}},"weekdays":{"format":{"abbreviated":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"narrow":["S","M","T","W","T","F","S"],"short":["Su","Mo","Tu","We","Th","Fr","Sa"],"wide":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]}},"day_periods":{"format":{"abbreviated":{"am":"AM","pm":"PM"},"narrow":{"am":"a","pm":"p"},"wide":{"am":"AM","pm":"PM"}},"stand_alone":{"narrow":{"am":"AM","pm":"PM"}}}},"patterns":{"date":{"full":"EEEE, MMMM d, y","long":"MMMM d, y","medium":"MMM d, y","short":"M/d/yy"},"time":{"full":"h:mm:ss a zzzz","long":"h:mm:ss a z","medium":"h:mm:ss a","short":"h:mm a"},"date_time":{"full":"{1} 'at' {0}","long":"{1} 'at' {0}","medium":"{1}, {0}","short":"{1}, {0}"}}} diff --git a/components/datetime/tests/fixtures/data/icu4x/dates/gregory@1/pl.json b/components/datetime/tests/fixtures/data/icu4x/dates/gregory@1/pl.json new file mode 100644 index 00000000000..f5c69ba1236 --- /dev/null +++ b/components/datetime/tests/fixtures/data/icu4x/dates/gregory@1/pl.json @@ -0,0 +1 @@ +{"symbols":{"months":{"format":{"abbreviated":["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],"narrow":["s","l","m","k","m","c","l","s","w","p","l","g"],"wide":["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"]},"stand_alone":{"narrow":["S","L","M","K","M","C","L","S","W","P","L","G"],"wide":["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"]}},"weekdays":{"format":{"abbreviated":["niedz.","pon.","wt.","śr.","czw.","pt.","sob."],"narrow":["n","p","w","ś","c","p","s"],"short":["nie","pon","wto","śro","czw","pią","sob"],"wide":["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"]},"stand_alone":{"narrow":["N","P","W","Ś","C","P","S"]}},"day_periods":{"format":{"abbreviated":{"am":"AM","pm":"PM"},"narrow":{"am":"a","pm":"p"},"wide":{"am":"AM","pm":"PM"}}}},"patterns":{"date":{"full":"EEEE, d MMMM y","long":"d MMMM y","medium":"d MMM y","short":"dd.MM.y"},"time":{"full":"HH:mm:ss zzzz","long":"HH:mm:ss z","medium":"HH:mm:ss","short":"HH:mm"},"date_time":{"full":"{1} {0}","long":"{1} {0}","medium":"{1}, {0}","short":"{1}, {0}"}}} diff --git a/components/datetime/tests/fixtures/data/icu4x/dates/manifest.json b/components/datetime/tests/fixtures/data/icu4x/dates/manifest.json new file mode 100644 index 00000000000..a68a792a8e3 --- /dev/null +++ b/components/datetime/tests/fixtures/data/icu4x/dates/manifest.json @@ -0,0 +1,4 @@ +{ + "aliasing": "NoAliases", + "syntax": "Json" +} diff --git a/components/datetime/tests/fixtures/data/icu4x/manifest.json b/components/datetime/tests/fixtures/data/icu4x/manifest.json new file mode 100644 index 00000000000..a68a792a8e3 --- /dev/null +++ b/components/datetime/tests/fixtures/data/icu4x/manifest.json @@ -0,0 +1,4 @@ +{ + "aliasing": "NoAliases", + "syntax": "Json" +} diff --git a/components/datetime/tests/fixtures/mod.rs b/components/datetime/tests/fixtures/mod.rs new file mode 100644 index 00000000000..a631f62df39 --- /dev/null +++ b/components/datetime/tests/fixtures/mod.rs @@ -0,0 +1,55 @@ +pub mod structs; + +use icu_datetime::date::DateTime; +use icu_datetime::options; +use icu_datetime::DateTimeFormatOptions; +use serde_json; +use std::fs::File; +use std::io::BufReader; + +pub fn get_fixture(name: &str) -> std::io::Result { + let file = File::open(format!("./tests/fixtures/tests/{}.json", name))?; + let reader = BufReader::new(file); + + Ok(serde_json::from_reader(reader)?) +} + +pub fn get_options(input: &structs::TestOptions) -> DateTimeFormatOptions { + let style = options::style::Bag { + date: match input.style.date { + Some(structs::TestStyleWidth::Full) => options::style::Date::Full, + Some(structs::TestStyleWidth::Long) => options::style::Date::Long, + Some(structs::TestStyleWidth::Medium) => options::style::Date::Medium, + Some(structs::TestStyleWidth::Short) => options::style::Date::Short, + None => options::style::Date::None, + }, + time: match input.style.time { + Some(structs::TestStyleWidth::Full) => options::style::Time::Full, + Some(structs::TestStyleWidth::Long) => options::style::Time::Long, + Some(structs::TestStyleWidth::Medium) => options::style::Time::Medium, + Some(structs::TestStyleWidth::Short) => options::style::Time::Short, + None => options::style::Time::None, + }, + ..Default::default() + }; + DateTimeFormatOptions::Style(style) +} + +pub fn parse_date(input: &str) -> Result { + let year: usize = input[0..4].parse()?; + let month: usize = input[5..7].parse()?; + let day: usize = input[8..10].parse()?; + let hour: usize = input[11..13].parse()?; + let minute: usize = input[14..16].parse()?; + let second: usize = input[17..19].parse()?; + let millisecond: usize = input[20..23].parse()?; + Ok(DateTime { + year, + month: month - 1, + day: day - 1, + hour, + minute, + second, + millisecond, + }) +} diff --git a/components/datetime/tests/fixtures/structs.rs b/components/datetime/tests/fixtures/structs.rs new file mode 100644 index 00000000000..de1adb4a51f --- /dev/null +++ b/components/datetime/tests/fixtures/structs.rs @@ -0,0 +1,45 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct Fixture(pub Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct Test { + pub input: TestInput, + pub output: TestOutput, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct TestInput { + pub locale: String, + pub value: String, + pub options: TestOptions, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct TestOptions { + pub style: TestOptionsStyle, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct TestOptionsStyle { + pub date: Option, + pub time: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub enum TestStyleWidth { + #[serde(rename = "short")] + Short, + #[serde(rename = "medium")] + Medium, + #[serde(rename = "long")] + Long, + #[serde(rename = "full")] + Full, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct TestOutput { + pub value: String, +} diff --git a/components/datetime/tests/fixtures/tests/styles.json b/components/datetime/tests/fixtures/tests/styles.json new file mode 100644 index 00000000000..096b15733f5 --- /dev/null +++ b/components/datetime/tests/fixtures/tests/styles.json @@ -0,0 +1,107 @@ +[ + { + "input": { + "locale": "en", + "value": "2020-01-21 08:25:07.000", + "options": { + "style": { + "time": "full", + "date": "full" + } + } + }, + "output": { + "value": "Tuesday, January 21, 2020 'at' 8:25:07 AM zzzz" + } + }, + { + "input": { + "locale": "en", + "value": "2020-09-10 13:34:59.000", + "options": { + "style": { + "time": "long", + "date": "long" + } + } + }, + "output": { + "value": "September 10, 2020 'at' 1:34:59 PM z" + } + }, + { + "input": { + "locale": "en", + "value": "2020-02-20 00:12:00.000", + "options": { + "style": { + "time": "medium", + "date": "medium" + } + } + }, + "output": { + "value": "Feb 20, 2020, 12:12:00 AM" + } + }, + { + "input": { + "locale": "en", + "value": "2000-01-30 22:15:11.000", + "options": { + "style": { + "time": "short", + "date": "short" + } + } + }, + "output": { + "value": "1/30/2000, 10:15 PM" + } + }, + { + "input": { + "locale": "en", + "value": "2045-02-01 18:45:10.000", + "options": { + "style": { + "time": null, + "date": "long" + } + } + }, + "output": { + "value": "February 1, 2045" + } + }, + { + "input": { + "locale": "en", + "value": "2045-02-01 18:45:10.000", + "options": { + "style": { + "time": "medium", + "date": null + } + } + }, + "output": { + "value": "6:45:10 PM" + } + }, + { + "input": { + "locale": "pl", + "value": "2020-03-21 08:25:07.000", + "options": { + "style": { + "time": "full", + "date": "full" + } + } + }, + "output": { + "value": "sobota, 21 marca 2020 08:25:07 zzzz" + } + } +] diff --git a/components/datetime/tests/pattern.rs b/components/datetime/tests/pattern.rs deleted file mode 100644 index 3eb4f36d3f2..00000000000 --- a/components/datetime/tests/pattern.rs +++ /dev/null @@ -1,31 +0,0 @@ -use icu_datetime::fields::{self, FieldLength, FieldSymbol}; -use icu_datetime::pattern::Pattern; - -#[test] -fn pattern_parse() { - assert_eq!( - Pattern::from_bytes(b"dd/MM/y").unwrap(), - vec![ - (fields::Day::DayOfMonth.into(), FieldLength::TwoDigit).into(), - "/".into(), - (fields::Month::Format.into(), FieldLength::TwoDigit).into(), - "/".into(), - (fields::Year::Calendar.into(), FieldLength::One).into(), - ] - .into_iter() - .collect() - ); - - assert_eq!( - Pattern::from_bytes(b"HH:mm:ss").unwrap(), - vec![ - (fields::Hour::H23.into(), FieldLength::TwoDigit).into(), - ":".into(), - (FieldSymbol::Minute, FieldLength::TwoDigit).into(), - ":".into(), - (fields::Second::Second.into(), FieldLength::TwoDigit).into(), - ] - .into_iter() - .collect() - ); -} From 4189d342a6fcf411fbdad86af769d2ef3d5fb5e5 Mon Sep 17 00:00:00 2001 From: Zibi Braniecki Date: Fri, 25 Sep 2020 21:19:04 -0700 Subject: [PATCH 04/15] Add docs and clean up the code --- components/datetime/benches/datetime.rs | 33 ++- components/datetime/benches/fixtures/mod.rs | 39 ++-- .../datetime/benches/fixtures/structs.rs | 4 +- components/datetime/src/date.rs | 61 ++++- components/datetime/src/error.rs | 2 + components/datetime/src/fields.rs | 103 +-------- components/datetime/src/format.rs | 78 +++++-- components/datetime/src/lib.rs | 202 ++++++++++++++++- components/datetime/src/options/components.rs | 104 +++++---- components/datetime/src/options/mod.rs | 61 ++++- .../datetime/src/options/preferences.rs | 79 ++++++- components/datetime/src/options/style.rs | 208 ++++++++++++++++-- components/datetime/src/provider.rs | 44 ++-- components/datetime/tests/fixtures/mod.rs | 38 ++-- 14 files changed, 765 insertions(+), 291 deletions(-) diff --git a/components/datetime/benches/datetime.rs b/components/datetime/benches/datetime.rs index b20be983955..b8ae1fb7e55 100644 --- a/components/datetime/benches/datetime.rs +++ b/components/datetime/benches/datetime.rs @@ -7,7 +7,6 @@ use icu_datetime::DateTimeFormat; use icu_fs_data_provider::FsDataProvider; fn datetime_benches(c: &mut Criterion) { - let fxs = fixtures::get_fixture("styles").unwrap(); let provider = FsDataProvider::try_new("./tests/fixtures/data/icu4x") @@ -19,7 +18,11 @@ fn datetime_benches(c: &mut Criterion) { group.bench_function("DateTimeFormat/format_to_write", |b| { b.iter(|| { for fx in &fxs.0 { - let datetimes: Vec<_> = fx.values.iter().map(|value| fixtures::parse_date(value).unwrap()).collect(); + let datetimes: Vec<_> = fx + .values + .iter() + .map(|value| fixtures::parse_date(value).unwrap()) + .collect(); for setup in &fx.setups { let langid = setup.locale.parse().unwrap(); @@ -29,7 +32,7 @@ fn datetime_benches(c: &mut Criterion) { let mut result = String::new(); for dt in &datetimes { - let _ = dtf.format_to_write(&mut result, &dt); + let _ = dtf.format_to_write(&mut result, dt); result.clear(); } } @@ -40,7 +43,11 @@ fn datetime_benches(c: &mut Criterion) { group.bench_function("DateTimeFormat/format_to_string", |b| { b.iter(|| { for fx in &fxs.0 { - let datetimes: Vec<_> = fx.values.iter().map(|value| fixtures::parse_date(value).unwrap()).collect(); + let datetimes: Vec<_> = fx + .values + .iter() + .map(|value| fixtures::parse_date(value).unwrap()) + .collect(); for setup in &fx.setups { let langid = setup.locale.parse().unwrap(); @@ -48,7 +55,7 @@ fn datetime_benches(c: &mut Criterion) { let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); for dt in &datetimes { - let _ = dtf.format_to_string(&dt); + let _ = dtf.format_to_string(dt); } } } @@ -58,7 +65,11 @@ fn datetime_benches(c: &mut Criterion) { group.bench_function("FormattedDateTime/format", |b| { b.iter(|| { for fx in &fxs.0 { - let datetimes: Vec<_> = fx.values.iter().map(|value| fixtures::parse_date(value).unwrap()).collect(); + let datetimes: Vec<_> = fx + .values + .iter() + .map(|value| fixtures::parse_date(value).unwrap()) + .collect(); for setup in &fx.setups { let langid = setup.locale.parse().unwrap(); @@ -68,7 +79,7 @@ fn datetime_benches(c: &mut Criterion) { let mut result = String::new(); for dt in &datetimes { - let fdt = dtf.format(&dt); + let fdt = dtf.format(dt); write!(result, "{}", fdt).unwrap(); result.clear(); } @@ -80,7 +91,11 @@ fn datetime_benches(c: &mut Criterion) { group.bench_function("FormattedDateTime/to_string", |b| { b.iter(|| { for fx in &fxs.0 { - let datetimes: Vec<_> = fx.values.iter().map(|value| fixtures::parse_date(value).unwrap()).collect(); + let datetimes: Vec<_> = fx + .values + .iter() + .map(|value| fixtures::parse_date(value).unwrap()) + .collect(); for setup in &fx.setups { let langid = setup.locale.parse().unwrap(); @@ -88,7 +103,7 @@ fn datetime_benches(c: &mut Criterion) { let dtf = DateTimeFormat::try_new(langid, &provider, &options).unwrap(); for dt in &datetimes { - let fdt = dtf.format(&dt); + let fdt = dtf.format(dt); let _ = fdt.to_string(); } } diff --git a/components/datetime/benches/fixtures/mod.rs b/components/datetime/benches/fixtures/mod.rs index e0b02ee0f43..b11359a98b1 100644 --- a/components/datetime/benches/fixtures/mod.rs +++ b/components/datetime/benches/fixtures/mod.rs @@ -1,8 +1,7 @@ pub mod structs; -use icu_datetime::date::DateTime; -use icu_datetime::options; -use icu_datetime::DateTimeFormatOptions; +use icu_datetime::options::{style, DateTimeFormatOptions}; +use icu_datetime::DummyDateTime; use serde_json; use std::fs::File; use std::io::BufReader; @@ -25,28 +24,26 @@ pub fn get_patterns_fixture() -> std::io::Result { #[allow(dead_code)] pub fn get_options(input: &structs::TestOptions) -> DateTimeFormatOptions { - let style = options::style::Bag { - date: match input.style.date { - Some(structs::TestStyleWidth::Full) => options::style::Date::Full, - Some(structs::TestStyleWidth::Long) => options::style::Date::Long, - Some(structs::TestStyleWidth::Medium) => options::style::Date::Medium, - Some(structs::TestStyleWidth::Short) => options::style::Date::Short, - None => options::style::Date::None, - }, - time: match input.style.time { - Some(structs::TestStyleWidth::Full) => options::style::Time::Full, - Some(structs::TestStyleWidth::Long) => options::style::Time::Long, - Some(structs::TestStyleWidth::Medium) => options::style::Time::Medium, - Some(structs::TestStyleWidth::Short) => options::style::Time::Short, - None => options::style::Time::None, - }, + let style = style::Bag { + date: input.style.date.as_ref().map(|date| match date { + structs::TestStyleWidth::Full => style::Date::Full, + structs::TestStyleWidth::Long => style::Date::Long, + structs::TestStyleWidth::Medium => style::Date::Medium, + structs::TestStyleWidth::Short => style::Date::Short, + }), + time: input.style.time.as_ref().map(|time| match time { + structs::TestStyleWidth::Full => style::Time::Full, + structs::TestStyleWidth::Long => style::Time::Long, + structs::TestStyleWidth::Medium => style::Time::Medium, + structs::TestStyleWidth::Short => style::Time::Short, + }), ..Default::default() }; - DateTimeFormatOptions::Style(style) + style.into() } #[allow(dead_code)] -pub fn parse_date(input: &str) -> Result { +pub fn parse_date(input: &str) -> Result { let year: usize = input[0..4].parse()?; let month: usize = input[5..7].parse()?; let day: usize = input[8..10].parse()?; @@ -54,7 +51,7 @@ pub fn parse_date(input: &str) -> Result { let minute: usize = input[14..16].parse()?; let second: usize = input[17..19].parse()?; let millisecond: usize = input[20..23].parse()?; - Ok(DateTime { + Ok(DummyDateTime { year, month: month - 1, day: day - 1, diff --git a/components/datetime/benches/fixtures/structs.rs b/components/datetime/benches/fixtures/structs.rs index 19655e55492..2306b52b27d 100644 --- a/components/datetime/benches/fixtures/structs.rs +++ b/components/datetime/benches/fixtures/structs.rs @@ -39,6 +39,4 @@ pub enum TestStyleWidth { } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct PatternsFixture( - pub Vec -); +pub struct PatternsFixture(pub Vec); diff --git a/components/datetime/src/date.rs b/components/datetime/src/date.rs index e3da3cfa116..1aa7f0ba91b 100644 --- a/components/datetime/src/date.rs +++ b/components/datetime/src/date.rs @@ -1,5 +1,27 @@ -#[derive(Default, Debug)] -pub struct DateTime { +/// Temporary trait used to represent the input data for `DateTimeFormat`. +/// +/// This type represents all data that the formatted needs in order to produced formatted string. +pub trait DateTimeType { + fn year(&self) -> usize; + fn month(&self) -> usize; + fn day(&self) -> usize; + fn hour(&self) -> usize; + fn minute(&self) -> usize; + fn second(&self) -> usize; + fn millisecond(&self) -> usize; +} +/// Temporary implementation of `DateTimeType`, +/// which is used in tests, benchmarks and examples of this component. +/// +/// # Examples +/// +/// ``` +/// use icu_datetime::DummyDateTime; +/// +/// let dt = DummyDateTime::new(2020, 9, 24, 13, 21, 0, 0); +/// ``` +#[derive(Debug, Default)] +pub struct DummyDateTime { pub year: usize, pub month: usize, pub day: usize, @@ -9,7 +31,16 @@ pub struct DateTime { pub millisecond: usize, } -impl DateTime { +impl DummyDateTime { + /// Constructor for the `DummyDateTime`. + /// + /// # Examples + /// + /// ``` + /// use icu_datetime::DummyDateTime; + /// + /// let dt = DummyDateTime::new(2020, 9, 24, 13, 21, 0, 0); + /// ``` pub fn new( year: usize, // 0- month: usize, // 0-11 @@ -30,3 +61,27 @@ impl DateTime { } } } + +impl DateTimeType for DummyDateTime { + fn year(&self) -> usize { + self.year + } + fn month(&self) -> usize { + self.month + } + fn day(&self) -> usize { + self.day + } + fn hour(&self) -> usize { + self.hour + } + fn minute(&self) -> usize { + self.minute + } + fn second(&self) -> usize { + self.second + } + fn millisecond(&self) -> usize { + self.millisecond + } +} diff --git a/components/datetime/src/error.rs b/components/datetime/src/error.rs index af5237cb257..46130c577fc 100644 --- a/components/datetime/src/error.rs +++ b/components/datetime/src/error.rs @@ -6,7 +6,9 @@ use icu_data_provider::prelude::DataError; /// [`DateTimeFormat`]: ./struct.DateTimeFormat.html #[derive(Debug)] pub enum DateTimeFormatError { + /// An error coming from a pattern parsing Pattern(pattern::Error), + /// An error indicating that data could not be retrieved MissingData, /// An error originating inside of the DataProvider DataProvider(DataError), diff --git a/components/datetime/src/fields.rs b/components/datetime/src/fields.rs index 316ec7461be..cb58108be8a 100644 --- a/components/datetime/src/fields.rs +++ b/components/datetime/src/fields.rs @@ -1,5 +1,3 @@ -use std::fmt; - #[derive(Debug)] pub enum Error { Unknown, @@ -44,20 +42,6 @@ pub enum FieldSymbol { } impl FieldSymbol { - pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { - match self { - Self::Era => w.write_char('G'), - Self::Year(year) => year.write(w), - Self::Month(month) => month.write(w), - Self::Day(day) => day.write(w), - Self::Weekday(weekday) => weekday.write(w), - Self::Period(period) => period.write(w), - Self::Hour(hour) => hour.write(w), - Self::Minute => w.write_char('m'), - Self::Second(second) => second.write(w), - } - } - pub fn from_byte(b: u8) -> Result { match b { b'G' => Ok(Self::Era), @@ -74,21 +58,7 @@ impl FieldSymbol { } } -#[derive(Debug, PartialEq, Clone, Copy)] -pub enum FieldType { - Era, - Year, - Month, - Day, - Hour, -} - -impl FieldType { - pub fn iter() -> impl Iterator { - [Self::Era, Self::Year, Self::Month, Self::Day].iter() - } -} - +#[allow(dead_code)] #[derive(Debug, PartialEq, Clone, Copy)] pub enum Year { Calendar, @@ -99,16 +69,6 @@ pub enum Year { } impl Year { - pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { - w.write_char(match self { - Self::Calendar => 'y', - Self::WeekOf => 'Y', - Self::Extended => 'u', - Self::Cyclic => 'U', - Self::RelatedGregorian => 'r', - }) - } - pub fn from_byte(b: u8) -> Result { match b { b'y' => Ok(Self::Calendar), @@ -131,13 +91,6 @@ pub enum Month { } impl Month { - pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { - w.write_char(match self { - Self::Format => 'M', - Self::StandAlone => 'L', - }) - } - pub fn from_byte(b: u8) -> Result { match b { b'M' => Ok(Self::Format), @@ -162,15 +115,6 @@ pub enum Day { } impl Day { - pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { - w.write_char(match self { - Self::DayOfMonth => 'd', - Self::DayOfYear => 'D', - Self::DayOfWeekInMonth => 'F', - Self::ModifiedJulianDay => 'g', - }) - } - pub fn from_byte(b: u8) -> Result { match b { b'd' => Ok(Self::DayOfMonth), @@ -200,18 +144,6 @@ pub enum Hour { } impl Hour { - pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { - w.write_char(match self { - Self::H11 => 'K', - Self::H12 => 'h', - Self::H23 => 'H', - Self::H24 => 'k', - Self::Preferred => 'j', - Self::PreferredNoDayPeriod => 'J', - Self::PreferredFlexibleDayPeriod => 'C', - }) - } - pub fn from_byte(b: u8) -> Result { match b { b'K' => Ok(Self::H11), @@ -246,14 +178,6 @@ pub enum Second { } impl Second { - pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { - w.write_char(match self { - Self::Second => 's', - Self::FractionalSecond => 'S', - Self::Millisecond => 'A', - }) - } - pub fn from_byte(b: u8) -> Result { match b { b's' => Ok(Self::Second), @@ -278,14 +202,6 @@ pub enum Weekday { } impl Weekday { - pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { - w.write_char(match self { - Self::Format => 'E', - Self::Local => 'e', - Self::StandAlone => 'c', - }) - } - pub fn from_byte(b: u8) -> Result { match b { b'E' => Ok(Self::Format), @@ -310,14 +226,6 @@ pub enum Period { } impl Period { - pub fn write(&self, w: &mut impl fmt::Write) -> fmt::Result { - w.write_char(match self { - Self::AmPm => 'a', - Self::NoonMidnight => 'b', - Self::Flexible => 'B', - }) - } - pub fn from_byte(b: u8) -> Result { match b { b'a' => Ok(Self::AmPm), @@ -340,14 +248,7 @@ pub struct Field { pub length: FieldLength, } -impl Field { - pub fn write_pattern(&self, w: &mut impl fmt::Write) -> fmt::Result { - for _ in 0..(self.length as u8) { - self.symbol.write(w)?; - } - Ok(()) - } -} +impl Field {} impl From<(FieldSymbol, FieldLength)> for Field { fn from(input: (FieldSymbol, FieldLength)) -> Self { diff --git a/components/datetime/src/format.rs b/components/datetime/src/format.rs index 21fed4876e4..865cad4b7b5 100644 --- a/components/datetime/src/format.rs +++ b/components/datetime/src/format.rs @@ -1,19 +1,52 @@ -use super::date::DateTime; +use super::date::DateTimeType; use crate::fields::{self, FieldLength, FieldSymbol}; use crate::pattern::{Pattern, PatternItem}; use crate::provider::DateTimeDates; use icu_data_provider::structs; use std::fmt; -pub struct FormattedDateTime<'l> { +/// `FormattedDateTime` is a intermediate structure which can be retrieved as +/// an output from `DateTimeFormat`. +/// +/// The structure contains all the information needed to display formatted value, +/// and it will also contain additional methods allowing the user to introspect +/// and even manipulate the formatted data. +/// +/// # Examples +/// +/// ``` +/// # use icu_locale::LanguageIdentifier; +/// # use icu_datetime::{DateTimeFormat, DateTimeFormatOptions}; +/// # use icu_datetime::DummyDateTime; +/// # use icu_data_provider::InvariantDataProvider; +/// # let langid: LanguageIdentifier = "en".parse() +/// # .expect("Failed to parse a language identifier."); +/// # let provider = InvariantDataProvider; +/// # let options = DateTimeFormatOptions::default(); +/// let dtf = DateTimeFormat::try_new(langid, &provider, &options) +/// .expect("Failed to create DateTimeFormat instance."); +/// +/// let date_time = DummyDateTime::new(2020, 9, 1, 12, 34, 28, 0); +/// +/// let formatted_date = dtf.format(&date_time); +/// +/// let _ = format!("Date: {}", formatted_date); +/// ``` +pub struct FormattedDateTime<'l, T> +where + T: DateTimeType, +{ pub(crate) pattern: &'l Pattern, pub(crate) data: &'l structs::dates::gregory::DatesV1, - pub(crate) date_time: &'l DateTime, + pub(crate) date_time: &'l T, } -impl<'l> fmt::Display for FormattedDateTime<'l> { +impl<'l, T> fmt::Display for FormattedDateTime<'l, T> +where + T: DateTimeType, +{ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write_pattern(self.pattern, &self.data, &self.date_time, f) + write_pattern(self.pattern, self.data, self.date_time, f) } } // Temporary formatting number with length. @@ -32,66 +65,69 @@ fn get_day_of_week(year: usize, month: usize, day: usize) -> usize { (year + year / 4 - year / 100 + year / 400 + t[month] + day + 1) % 7 } -pub fn write_pattern( +pub fn write_pattern( pattern: &crate::pattern::Pattern, data: &structs::dates::gregory::DatesV1, - date_time: &DateTime, + date_time: &T, w: &mut impl fmt::Write, -) -> std::fmt::Result { +) -> std::fmt::Result +where + T: DateTimeType, +{ for item in &pattern.0 { match item { PatternItem::Field(field) => match field.symbol { - FieldSymbol::Year(..) => format_number(w, date_time.year, &field.length)?, + FieldSymbol::Year(..) => format_number(w, date_time.year(), &field.length)?, FieldSymbol::Month(month) => match field.length { FieldLength::One | FieldLength::TwoDigit => { - format_number(w, date_time.month + 1, &field.length)? + format_number(w, date_time.month() + 1, &field.length)? } length => { let symbol = data - .get_symbol_for_month(month, length, date_time.month) + .get_symbol_for_month(month, length, date_time.month()) .unwrap() .unwrap(); w.write_str(symbol)? } }, FieldSymbol::Weekday(weekday) => { - let dow = get_day_of_week(date_time.year, date_time.month, date_time.day); + let dow = get_day_of_week(date_time.year(), date_time.month(), date_time.day()); let symbol = data .get_symbol_for_weekday(weekday, field.length, dow) .unwrap() .unwrap(); w.write_str(symbol)? } - FieldSymbol::Day(..) => format_number(w, date_time.day + 1, &field.length)?, + FieldSymbol::Day(..) => format_number(w, date_time.day() + 1, &field.length)?, FieldSymbol::Hour(hour) => { let value = match hour { - fields::Hour::H11 => date_time.hour % 12, + fields::Hour::H11 => date_time.hour() % 12, fields::Hour::H12 => { - let v = date_time.hour % 12; + let v = date_time.hour() % 12; if v == 0 { 12 } else { v } } - fields::Hour::H23 => date_time.hour, + fields::Hour::H23 => date_time.hour(), fields::Hour::H24 => { - if date_time.hour == 0 { + if date_time.hour() == 0 { 24 } else { - date_time.hour + date_time.hour() } } _ => unimplemented!(), }; format_number(w, value, &field.length)? } - FieldSymbol::Minute => format_number(w, date_time.minute, &field.length)?, - FieldSymbol::Second(..) => format_number(w, date_time.second, &field.length)?, + FieldSymbol::Minute => format_number(w, date_time.minute(), &field.length)?, + FieldSymbol::Second(..) => format_number(w, date_time.second(), &field.length)?, FieldSymbol::Period(period) => match period { fields::Period::AmPm => { let symbol = data - .get_symbol_for_day_period(period, field.length, date_time.hour) + .get_symbol_for_day_period(period, field.length, date_time.hour()) .unwrap() .unwrap(); w.write_str(symbol)? diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs index 52004665744..6030690f4fb 100644 --- a/components/datetime/src/lib.rs +++ b/components/datetime/src/lib.rs @@ -1,22 +1,104 @@ -pub mod date; +//! `icu-datetime` is one of the [`ICU4X`] components. +//! +//! It is a core API for formatting date and time to user readable textual representation. +//! +//! [`DateTimeFormat`] is the main structure of the component. It accepts a set of arguments which +//! allow it to collect necessary data from the `DataProvider`, and once instantiated, can be +//! used to quickly format any date and time provided. +//! +//! # Examples +//! +//! ``` +//! use icu_locale::LanguageIdentifier; +//! use icu_datetime::{DateTimeFormat, options::style}; +//! use icu_datetime::DummyDateTime; +//! use icu_data_provider::InvariantDataProvider; +//! +//! let langid: LanguageIdentifier = "en".parse() +//! .expect("Failed to parse a language identifier."); +//! +//! let provider = InvariantDataProvider; +//! +//! let options = style::Bag { +//! date: Some(style::Date::Medium), +//! time: Some(style::Time::Short), +//! ..Default::default() +//! }; +//! let dtf = DateTimeFormat::try_new(langid, &provider, &options.into()) +//! .expect("Failed to create DateTimeFormat instance."); +//! +//! +//! let date_time = DummyDateTime::new(2020, 9, 1, 12, 34, 28, 0); +//! +//! let value = dtf.format_to_string(&date_time); +//! ``` +//! +//! At the moment, the crate provides only options using the `Style` bag, but in the future, +//! we expect to add more ways to customize the output, like skeletons, and components. +//! +//! *Notice:* Rust at the moment does not have a canonical way to represent date and time. We are introducing +//! `date::DummyDateTime` as a reference example of the data necessary for ICU DateTimeFormat to work, and +//! we hope to work with the community to develop core date and time APIs that will work as an input for this component. +//! +//! [`DateTimeFormat`]: ./struct.DateTimeFormat.html +//! [`ICU4X`]: https://github.com/unicode-org/icu4x +mod date; mod error; -pub mod fields; +mod fields; mod format; pub mod options; +#[doc(hidden)] pub mod pattern; mod provider; -use date::DateTime; +pub use date::{DateTimeType, DummyDateTime}; pub use error::DateTimeFormatError; use format::write_pattern; pub use format::FormattedDateTime; use icu_data_provider::{icu_data_key, structs, DataEntry, DataProvider, DataRequest}; use icu_locale::LanguageIdentifier; +#[doc(inline)] pub use options::DateTimeFormatOptions; use pattern::Pattern; use provider::DateTimeDates; use std::borrow::Cow; +/// `DateTimeFormat` is the main structure of the `icu-datetime` component. +/// When constructed, it uses data from the `DataProvider`, selected `LanguageIdentifier` and provided options to +/// collect all data necessary to format any dates into that locale. +/// +/// For that reason, one should think of the process of formatting a date in two steps - first, a computational +/// heavy construction of `DateTimeFormat`, and then fast formatting of `DateTime` data using the instance. +/// +/// # Examples +/// +/// ``` +/// use icu_locale::LanguageIdentifier; +/// use icu_datetime::{DateTimeFormat, options::style}; +/// use icu_datetime::DummyDateTime; +/// use icu_data_provider::InvariantDataProvider; +/// +/// let langid: LanguageIdentifier = "en".parse() +/// .expect("Failed to parse a language identifier."); +/// +/// let provider = InvariantDataProvider; +/// +/// let options = style::Bag { +/// date: Some(style::Date::Medium), +/// time: Some(style::Time::Short), +/// ..Default::default() +/// }; +/// let dtf = DateTimeFormat::try_new(langid, &provider, &options.into()) +/// .expect("Failed to create DateTimeFormat instance."); +/// +/// +/// let date_time = DummyDateTime::new(2020, 9, 1, 12, 34, 28, 0); +/// +/// let value = dtf.format_to_string(&date_time); +/// ``` +/// +/// This model replicates that of `ICU` and `ECMA402` and in the future will get even more pronounce when we introduce +/// asynchronous `DataProvider` and corresponding asynchronous constructor. pub struct DateTimeFormat<'d> { _langid: LanguageIdentifier, pattern: Pattern, @@ -24,6 +106,28 @@ pub struct DateTimeFormat<'d> { } impl<'d> DateTimeFormat<'d> { + /// `DateTimeFormat` constructor which takes a selected `LanguageIdentifier`, reference to a `DataProvider` and + /// a list of options and collects all data necessary to format date and time values into the given locale. + /// + /// # Examples + /// + /// ``` + /// use icu_locale::LanguageIdentifier; + /// use icu_datetime::{DateTimeFormat, DateTimeFormatOptions}; + /// use icu_datetime::DummyDateTime; + /// use icu_data_provider::InvariantDataProvider; + /// + /// let langid: LanguageIdentifier = "en".parse() + /// .expect("Failed to parse a language identifier."); + /// + /// let provider = InvariantDataProvider; + /// + /// let options = DateTimeFormatOptions::default(); + /// + /// let dtf = DateTimeFormat::try_new(langid, &provider, &options); + /// + /// assert_eq!(dtf.is_ok(), true); + /// ``` pub fn try_new>( langid: LanguageIdentifier, data_provider: &D, @@ -52,7 +156,37 @@ impl<'d> DateTimeFormat<'d> { }) } - pub fn format<'s>(&'s self, value: &'s DateTime) -> FormattedDateTime<'s> { + /// `format` takes a `DateTime` value and returns an instance of a `FormattedDateTime` object + /// which contains all information necessary to display a formatted date and operate on it. + /// + /// # Examples + /// + /// ``` + /// # use icu_locale::LanguageIdentifier; + /// # use icu_datetime::{DateTimeFormat, DateTimeFormatOptions}; + /// # use icu_datetime::DummyDateTime; + /// # use icu_data_provider::InvariantDataProvider; + /// # let langid: LanguageIdentifier = "en".parse() + /// # .expect("Failed to parse a language identifier."); + /// # let provider = InvariantDataProvider; + /// # let options = DateTimeFormatOptions::default(); + /// let dtf = DateTimeFormat::try_new(langid, &provider, &options) + /// .expect("Failed to create DateTimeFormat instance."); + /// + /// let date_time = DummyDateTime::new(2020, 9, 1, 12, 34, 28, 0); + /// + /// let formatted_date = dtf.format(&date_time); + /// + /// let _ = format!("Date: {}", formatted_date); + /// ``` + /// + /// At the moment, there's little value in using that over one of the other `format` methods, + /// but `FormattedDateTime` will grow with methods for iterating over fields, extracting information + /// about formatted date and so on. + pub fn format<'s, T>(&'s self, value: &'s T) -> FormattedDateTime<'s, T> + where + T: DateTimeType, + { FormattedDateTime { pattern: &self.pattern, data: &self.data, @@ -60,15 +194,63 @@ impl<'d> DateTimeFormat<'d> { } } - pub fn format_to_write( - &self, - w: &mut impl std::fmt::Write, - value: &DateTime, - ) -> std::fmt::Result { + /// `format_to_write` takes a mutable reference to anything that implements `Write` trait + /// and a `DateTime` value and populates the buffer with a formatted value. + /// + /// # Examples + /// + /// ``` + /// # use icu_locale::LanguageIdentifier; + /// # use icu_datetime::{DateTimeFormat, DateTimeFormatOptions}; + /// # use icu_datetime::DummyDateTime; + /// # use icu_data_provider::InvariantDataProvider; + /// # let langid: LanguageIdentifier = "en".parse() + /// # .expect("Failed to parse a language identifier."); + /// # let provider = InvariantDataProvider; + /// # let options = DateTimeFormatOptions::default(); + /// let dtf = DateTimeFormat::try_new(langid, &provider, &options.into()) + /// .expect("Failed to create DateTimeFormat instance."); + /// + /// let date_time = DummyDateTime::new(2020, 9, 1, 12, 34, 28, 0); + /// + /// let mut buffer = String::new(); + /// dtf.format_to_write(&mut buffer, &date_time) + /// .expect("Failed to write to a buffer."); + /// + /// let _ = format!("Date: {}", buffer); + /// ``` + pub fn format_to_write(&self, w: &mut impl std::fmt::Write, value: &T) -> std::fmt::Result + where + T: DateTimeType, + { write_pattern(&self.pattern, &self.data, value, w) } - pub fn format_to_string(&self, value: &DateTime) -> String { + /// `format_to_string` takes a `DateTime` value and returns it formatted + /// as a string. + /// + /// # Examples + /// + /// ``` + /// # use icu_locale::LanguageIdentifier; + /// # use icu_datetime::{DateTimeFormat, DateTimeFormatOptions}; + /// # use icu_datetime::DummyDateTime; + /// # use icu_data_provider::InvariantDataProvider; + /// # let langid: LanguageIdentifier = "en".parse() + /// # .expect("Failed to parse a language identifier."); + /// # let provider = InvariantDataProvider; + /// # let options = DateTimeFormatOptions::default(); + /// let dtf = DateTimeFormat::try_new(langid, &provider, &options.into()) + /// .expect("Failed to create DateTimeFormat instance."); + /// + /// let date_time = DummyDateTime::new(2020, 9, 1, 12, 34, 28, 0); + /// + /// let _ = dtf.format_to_string(&date_time); + /// ``` + pub fn format_to_string(&self, value: &T) -> String + where + T: DateTimeType, + { let mut s = String::new(); self.format_to_write(&mut s, value) .expect("Failed to write to a String."); diff --git a/components/datetime/src/options/components.rs b/components/datetime/src/options/components.rs index 32478a7820f..33d917f9733 100644 --- a/components/datetime/src/options/components.rs +++ b/components/datetime/src/options/components.rs @@ -1,18 +1,58 @@ +//! Components is a model of encoding information on how to format date and time by specifying a list of components +//! the user wants to be visible in the formatted string and how each field should be displayed. +//! +//! This model closely corresponds to `ECMA402` API and allows for high level of customization compared to `Style` model. +//! +//! Additionally, the bag contains an optional set of `Preferences` which represent user preferred adjustments +//! that can be applied onto the pattern right before formatting. +//! +//! # Pattern Selection +//! +//! It is important to understand that the components bag is a human-friendly way to describe a skeleton, not a pattern. +//! That means that the components and their styles provided by the user will be matched against available patterns for +//! a given locale and the closest available pattern will be used for formatting. +//! +//! That means, that it is possible that if the user asks for a combination of fields or lengths that `CLDR` has no +//! data associated with, the selected pattern may be different than the selection in the `Components` bag. +//! Such scenarios should be rare. +//! +//! # Examples +//! +//! ``` +//! use icu_datetime::options::components; +//! +//! let options = components::Bag { +//! year: Some(components::Numeric::Numeric), +//! month: Some(components::Month::Long), +//! day: Some(components::Numeric::Numeric), +//! +//! hour: Some(components::Numeric::TwoDigit), +//! minute: Some(components::Numeric::TwoDigit), +//! +//! preferences: None, +//! +//! ..Default::default() +//! }; +//! ``` +//! +//! *Note*: The exact result returned from [`DateTimeFormat`] is a subject to change over +//! time. Formatted result should be treated as opaque and displayed to the user as-is, +//! and it is strongly recommended to never write tests that expect a particular formatted output. use super::preferences; #[derive(Debug)] pub struct Bag { - pub era: Text, - pub year: Numeric, - pub month: Month, - pub day: Numeric, - pub weekday: Text, + pub era: Option, + pub year: Option, + pub month: Option, + pub day: Option, + pub weekday: Option, - pub hour: Numeric, - pub minute: Numeric, - pub second: Numeric, + pub hour: Option, + pub minute: Option, + pub second: Option, - pub time_zone_name: TimeZoneName, + pub time_zone_name: Option, pub preferences: Option, } @@ -20,17 +60,17 @@ pub struct Bag { impl Default for Bag { fn default() -> Self { Self { - era: Text::default(), - year: Numeric::Numeric, - month: Month::Long, - day: Numeric::Numeric, - weekday: Text::default(), + era: None, + year: Some(Numeric::Numeric), + month: Some(Month::Long), + day: Some(Numeric::Numeric), + weekday: None, - hour: Numeric::Numeric, - minute: Numeric::Numeric, - second: Numeric::Numeric, + hour: Some(Numeric::Numeric), + minute: Some(Numeric::Numeric), + second: Some(Numeric::Numeric), - time_zone_name: TimeZoneName::default(), + time_zone_name: None, preferences: None, } @@ -41,13 +81,6 @@ impl Default for Bag { pub enum Numeric { Numeric, TwoDigit, - None, -} - -impl Default for Numeric { - fn default() -> Self { - Self::None - } } #[derive(Debug, Clone, Copy, PartialEq)] @@ -55,13 +88,6 @@ pub enum Text { Long, Short, Narrow, - None, -} - -impl Default for Text { - fn default() -> Self { - Self::None - } } #[derive(Debug, Clone, Copy, PartialEq)] @@ -71,24 +97,10 @@ pub enum Month { Long, Short, Narrow, - None, -} - -impl Default for Month { - fn default() -> Self { - Self::None - } } #[derive(Debug, Clone, Copy, PartialEq)] pub enum TimeZoneName { Long, Short, - None, -} - -impl Default for TimeZoneName { - fn default() -> Self { - Self::None - } } diff --git a/components/datetime/src/options/mod.rs b/components/datetime/src/options/mod.rs index d04758fec54..f51a3fd8a3e 100644 --- a/components/datetime/src/options/mod.rs +++ b/components/datetime/src/options/mod.rs @@ -1,10 +1,57 @@ +//! `DateTimeFormatOptions` is a bag of options which, together with `LanguageIdentifier`, +//! define how dates will be formatted be a `DateTimeFormat` instance. +//! +//! Each variant of the bag is a combination of settings definiting how to format +//! the date, with an optional `Preferences` which represent user preferences and +//! may alter how the selected pattern is formatted. +//! +//! # Examples +//! +//! ``` +//! use icu_datetime::{DateTimeFormatOptions, options::style}; +//! +//! let options = DateTimeFormatOptions::Style( +//! style::Bag { +//! date: Some(style::Date::Medium), +//! time: Some(style::Time::Short), +//! ..Default::default() +//! } +//! ); +//! ``` +//! +//! At the moment only the `Style` bag works, and we plan to extend that to support +//! `ECMA 402` like components bag later. pub mod components; pub mod preferences; pub mod style; - +/// `DateTimeFormatOptions` is a bag of options which, together with `LanguageIdentifier`, +/// define how dates will be formatted be a `DateTimeFormat` instance. +/// +/// Each variant of the bag is a combination of settings definiting how to format +/// the date, with an optional `Preferences` which represent user preferences and +/// may alter how the selected pattern is formatted. +/// +/// # Examples +/// +/// ``` +/// use icu_datetime::{DateTimeFormatOptions, options::style}; +/// +/// let options = DateTimeFormatOptions::Style( +/// style::Bag { +/// date: Some(style::Date::Medium), +/// time: Some(style::Time::Short), +/// ..Default::default() +/// } +/// ); +/// ``` +/// +/// At the moment only the `Style` bag works, and we plan to extend that to support +/// `ECMA 402` like components bag later. #[derive(Debug)] pub enum DateTimeFormatOptions { + /// Bag of styles for date and time Style(style::Bag), + /// Bag of components describing which fields and how should be displayed Components(components::Bag), } @@ -13,3 +60,15 @@ impl Default for DateTimeFormatOptions { Self::Style(style::Bag::default()) } } + +impl From for DateTimeFormatOptions { + fn from(input: style::Bag) -> Self { + Self::Style(input) + } +} + +impl From for DateTimeFormatOptions { + fn from(input: components::Bag) -> Self { + Self::Components(input) + } +} diff --git a/components/datetime/src/options/preferences.rs b/components/datetime/src/options/preferences.rs index b80945fa754..3528bba0d37 100644 --- a/components/datetime/src/options/preferences.rs +++ b/components/datetime/src/options/preferences.rs @@ -1,23 +1,85 @@ +//! Preferences is a bag of options to be associated with either `Style` or `Components` bag which provides +//! information on user preferences that can affect the result of the formatting. +//! +//! # Unicode Extensions +//! User preferences will often be stored as part of the `Locale` identified as `Unicode Extensions`, but +//! for scenarios where the application stores information about user preferences they can be also provided via +//! this bag (and if they are, they will take precedence over unicode extensions from the locale). +//! +//! # Examples +//! +//! ``` +//! use icu_datetime::options::preferences; +//! +//! let prefs = preferences::Bag { +//! hour_cycle: Some(preferences::HourCycle::H23) +//! }; +//! ``` use crate::fields; +/// Bag of preferences stores user preferences which may affect the result of date and time formatting. +/// +/// # Examples +/// +/// ``` +/// use icu_datetime::options::preferences; +/// +/// let prefs = preferences::Bag { +/// hour_cycle: Some(preferences::HourCycle::H23) +/// }; +/// ``` #[derive(Debug)] pub struct Bag { - pub hour_cycle: HourCycle, + pub hour_cycle: Option, } +/// User Preference for adjusting how hour component is displayed. #[derive(Debug, Clone, Copy, PartialEq)] pub enum HourCycle { + /// Hour is formatted to be in range 1-24 + /// + /// # Examples + /// + /// ``` + /// "24:12"; + /// "8:23"; + /// "19:00"; + /// "23:21"; + /// ``` H24, + /// Hour is formatted to be in range 0-23 + /// + /// # Examples + /// + /// ``` + /// "0:12"; + /// "8:23"; + /// "19:00"; + /// "23:21"; + /// ``` H23, + /// Hour is formatted to be in range 1-12 + /// + /// # Examples + /// + /// ``` + /// "1:12"; + /// "8:23"; + /// "7:00"; + /// "11:21"; + /// ``` H12, + /// Hour is formatted to be in range 0-11 + /// + /// # Examples + /// + /// ``` + /// "0:12"; + /// "8:23"; + /// "7:00"; + /// "11:21"; + /// ``` H11, - None, -} - -impl Default for HourCycle { - fn default() -> Self { - Self::None - } } impl HourCycle { @@ -27,7 +89,6 @@ impl HourCycle { Self::H12 => fields::Hour::H12, Self::H23 => fields::Hour::H23, Self::H24 => fields::Hour::H24, - Self::None => fields::Hour::Preferred, } } } diff --git a/components/datetime/src/options/style.rs b/components/datetime/src/options/style.rs index 4a2679b99bb..53ab8408f24 100644 --- a/components/datetime/src/options/style.rs +++ b/components/datetime/src/options/style.rs @@ -1,48 +1,218 @@ +//! Style is a model of encoding information on how to format date and time by specifying the preferred length +//! of date and time fields. +//! +//! If either of the fields is omitted, the value will be formatted according to the pattern associated with the +//! preferred length of the present field in a given locale. +//! +//! If both fields are present, both parts of the value will be formatted and an additional connector pattern +//! will be used to construct a full result. +//! The type of the connector is determined by the length of the `Date` field. +//! +//! Additionally, the bag contains an optional set of `Preferences` which represent user preferred adjustments +//! that can be applied onto the pattern right before formatting. +//! +//! # Examples +//! +//! ``` +//! use icu_datetime::options::style; +//! +//! let options = style::Bag { +//! date: Some(style::Date::Medium), // `Medium` length connector will be used +//! time: Some(style::Time::Short), +//! preferences: None, +//! }; +//! ``` +//! +//! *Note*: The exact result returned from [`DateTimeFormat`] is a subject to change over +//! time. Formatted result should be treated as opaque and displayed to the user as-is, +//! and it is strongly recommended to never write tests that expect a particular formatted output. use super::preferences; - +/// `style::Bag` is a structure to represent the set of styles in which the DateTime should +/// be formatted to. +/// +/// The available lengths correspond to [`UTS #35: Unicode LDML 4. Dates`], section 2.4 [`Element dateFormats`]. +/// +/// # Examples +/// +/// ``` +/// use icu_datetime::options::style; +/// +/// let options = style::Bag { +/// date: Some(style::Date::Medium), +/// time: Some(style::Time::Short), +/// preferences: None, +/// }; +/// ``` +/// +/// [`UTS #35: Unicode LDML 4. Dates`]: https://unicode.org/reports/tr35/tr35-dates.html +/// [`Element dateFormats`]: https://unicode.org/reports/tr35/tr35-dates.html#dateFormats #[derive(Debug)] pub struct Bag { - pub date: Date, - pub time: Time, + pub date: Option, + pub time: Option