Skip to content

Commit

Permalink
Clean up last remaining traces of unicode-org#1109
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed Jul 18, 2022
1 parent 0c5290e commit dacfdf4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
27 changes: 10 additions & 17 deletions components/datetime/src/raw/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ impl TimeFormatter {
preferences,
)?;

// TODO(#1109): Implement proper vertical fallback
let mut locale_no_extensions = locale.clone();
locale_no_extensions.extensions.unicode.clear();

let required = datetime::analyze_patterns(&patterns.get().0, false)
.map_err(|field| DateTimeFormatterError::UnsupportedField(field.symbol))?;

Expand All @@ -86,7 +82,8 @@ impl TimeFormatter {
fixed_decimal_format_options.grouping_strategy = GroupingStrategy::Never;

let fixed_decimal_format = FixedDecimalFormatter::try_new(
locale_no_extensions,
// TODO(#2136): Don't clone here
locale.clone(),
data_provider,
fixed_decimal_format_options,
)
Expand Down Expand Up @@ -224,13 +221,10 @@ impl DateFormatter {
None
};

// TODO(#1109): Implement proper vertical fallback
let mut locale_no_extensions = locale.clone();
locale_no_extensions.extensions.unicode.clear();

let ordinal_rules = if let PatternPlurals::MultipleVariants(_) = &patterns.get().0 {
Some(PluralRules::try_new_ordinal(
locale_no_extensions.clone(),
// TODO(#2136): Don't clone here
locale.clone(),
data_provider,
)?)
} else {
Expand All @@ -254,7 +248,8 @@ impl DateFormatter {
fixed_decimal_format_options.grouping_strategy = GroupingStrategy::Never;

let fixed_decimal_format = FixedDecimalFormatter::try_new(
locale_no_extensions,
// TODO(#2136): Don't clone here
locale.clone(),
data_provider,
fixed_decimal_format_options,
)
Expand Down Expand Up @@ -445,13 +440,10 @@ impl DateTimeFormatter {
None
};

// TODO(#1109): Implement proper vertical fallback
let mut locale_no_extensions = locale.clone();
locale_no_extensions.extensions.unicode.clear();

let ordinal_rules = if let PatternPlurals::MultipleVariants(_) = &patterns.get().0 {
Some(PluralRules::try_new_ordinal(
locale_no_extensions.clone(),
// TODO(#2136): Don't clone here
locale.clone(),
data_provider,
)?)
} else {
Expand Down Expand Up @@ -488,7 +480,8 @@ impl DateTimeFormatter {
fixed_decimal_format_options.grouping_strategy = GroupingStrategy::Never;

let fixed_decimal_format = FixedDecimalFormatter::try_new(
locale_no_extensions,
// TODO(#2136): Don't clone here
locale.clone(),
data_provider,
fixed_decimal_format_options,
)
Expand Down
15 changes: 7 additions & 8 deletions components/datetime/src/raw/zoned_datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,10 @@ impl ZonedDateTimeFormatter {
None
};

// TODO(#1109): Implement proper vertical fallback
let mut locale_no_extensions = locale.clone();
locale_no_extensions.extensions.unicode.clear();

let ordinal_rules = if let PatternPlurals::MultipleVariants(_) = &patterns.get().0 {
Some(PluralRules::try_new_ordinal(
locale_no_extensions.clone(),
// TODO(#2136): Don't clone here
locale.clone(),
plural_provider,
)?)
} else {
Expand Down Expand Up @@ -147,14 +144,16 @@ impl ZonedDateTimeFormatter {
fixed_decimal_format_options.grouping_strategy = GroupingStrategy::Never;

let fixed_decimal_format = FixedDecimalFormatter::try_new(
locale_no_extensions.clone(),
// TODO(#2136): Don't clone here
locale.clone(),
decimal_provider,
fixed_decimal_format_options,
)
.map_err(DateTimeFormatterError::FixedDecimalFormatter)?;

let datetime_format = raw::DateTimeFormatter::new(
locale,
// TODO(#2136): Don't clone here
locale.clone(),
patterns,
date_symbols_data,
time_symbols_data,
Expand All @@ -164,7 +163,7 @@ impl ZonedDateTimeFormatter {
);

let time_zone_format = TimeZoneFormatter::try_new(
locale_no_extensions,
locale,
datetime_format
// Only dates have plural variants so we can use any of the patterns for the time segment.
.patterns
Expand Down
1 change: 0 additions & 1 deletion provider/datagen/src/transform/cldr/list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ impl<M: ResourceMarker<Yokeable = ListFormatterPatternsV1<'static>>> ResourcePro
}

let metadata = DataResponseMetadata::default();
// TODO(#1109): Set metadata.data_langid correctly.
Ok(DataResponse {
metadata,
payload: Some(DataPayload::from_owned(patterns)),
Expand Down

0 comments on commit dacfdf4

Please sign in to comment.