Skip to content

Commit 0d229ae

Browse files
CLDR 46 Alpha0 (#5479)
1 parent 7751731 commit 0d229ae

File tree

838 files changed

+34131
-18409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

838 files changed

+34131
-18409
lines changed

components/datetime/src/format/neo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2700,7 +2700,7 @@ mod tests {
27002700
pattern: "<EEEE>",
27012701
field_symbol: fields::Weekday::Format,
27022702
field_length: FieldLength::Wide,
2703-
expected: "<пʼятницю>",
2703+
expected: "<пʼятниця>",
27042704
},
27052705
TestCase {
27062706
pattern: "<EEEEE>",
@@ -2725,7 +2725,7 @@ mod tests {
27252725
pattern: "<eeee>",
27262726
field_symbol: fields::Weekday::Format,
27272727
field_length: FieldLength::Wide,
2728-
expected: "<пʼятницю>",
2728+
expected: "<пʼятниця>",
27292729
},
27302730
TestCase {
27312731
pattern: "<eeeee>",

components/datetime/tests/fixtures/tests/components_hour_cycle.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
},
119119
"output": {
120120
"values": {
121-
"ar": "٠:٢٥ ص"
121+
"ar-EG": "٠:٢٥ ص"
122122
}
123123
}
124124
},
@@ -140,7 +140,7 @@
140140
},
141141
"output": {
142142
"values": {
143-
"ar": "١٢:٢٥ ص"
143+
"ar-EG": "١٢:٢٥ ص"
144144
}
145145
}
146146
},
@@ -162,7 +162,7 @@
162162
},
163163
"output": {
164164
"values": {
165-
"ar": "٠٠:٢٥"
165+
"ar-EG": "٠٠:٢٥"
166166
}
167167
}
168168
},
@@ -184,7 +184,7 @@
184184
},
185185
"output": {
186186
"values": {
187-
"ar": "٢٤:٢٥"
187+
"ar-EG": "٢٤:٢٥"
188188
}
189189
}
190190
},

components/experimental/tests/relativetime/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ macro_rules! generate_test {
2929
)+
3030

3131
let relative_time_formatter = RelativeTimeFormatter::$constructor(
32-
&locale!("ar").into(),
32+
&locale!("ar-EG").into(),
3333
$options
3434
)
3535
.expect("locale should be present");

components/timezone/src/ids.rs

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use zerotrie::cursor::ZeroAsciiIgnoreCaseTrieCursor;
1010

1111
use crate::{
1212
provider::names::{
13-
Bcp47ToIanaMapV1, Bcp47ToIanaMapV1Marker, IanaToBcp47MapV2, IanaToBcp47MapV2Marker,
13+
Bcp47ToIanaMapV1, Bcp47ToIanaMapV1Marker, IanaToBcp47MapV3, IanaToBcp47MapV3Marker,
14+
NON_REGION_CITY_PREFIX,
1415
},
1516
TimeZoneBcp47Id,
1617
};
@@ -89,7 +90,7 @@ use crate::{
8990
/// ```
9091
#[derive(Debug, Clone)]
9192
pub struct TimeZoneIdMapper {
92-
data: DataPayload<IanaToBcp47MapV2Marker>,
93+
data: DataPayload<IanaToBcp47MapV3Marker>,
9394
}
9495

9596
#[cfg(feature = "compiled_data")]
@@ -111,7 +112,7 @@ impl TimeZoneIdMapper {
111112
pub fn new() -> Self {
112113
Self {
113114
data: DataPayload::from_static_ref(
114-
crate::provider::Baked::SINGLETON_IANA_TO_BCP47_MAP_V2_MARKER,
115+
crate::provider::Baked::SINGLETON_IANA_TO_BCP47_MAP_V3_MARKER,
115116
),
116117
}
117118
}
@@ -129,7 +130,7 @@ impl TimeZoneIdMapper {
129130
#[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new)]
130131
pub fn try_new_unstable<P>(provider: &P) -> Result<Self, DataError>
131132
where
132-
P: DataProvider<IanaToBcp47MapV2Marker> + ?Sized,
133+
P: DataProvider<IanaToBcp47MapV3Marker> + ?Sized,
133134
{
134135
let data = provider.load(Default::default())?.payload;
135136
Ok(Self { data })
@@ -156,7 +157,7 @@ impl AsRef<TimeZoneIdMapper> for TimeZoneIdMapper {
156157
/// [`TimeZoneIdMapper::as_borrowed()`]. More efficient to query.
157158
#[derive(Debug, Copy, Clone)]
158159
pub struct TimeZoneIdMapperBorrowed<'a> {
159-
data: &'a IanaToBcp47MapV2<'a>,
160+
data: &'a IanaToBcp47MapV3<'a>,
160161
}
161162

162163
impl<'a> TimeZoneIdMapperBorrowed<'a> {
@@ -269,7 +270,7 @@ impl<'a> TimeZoneIdMapperBorrowed<'a> {
269270
// nearby the input IANA identifier. This should improve lookup time since
270271
// most renames share the same prefix like "Asia" or "Europe".
271272
let mut stack = Vec::with_capacity(iana_id.len());
272-
let (trie_value, string) = self.iana_lookup_with_normalization(iana_id, |cursor| {
273+
let (trie_value, mut string) = self.iana_lookup_with_normalization(iana_id, |cursor| {
273274
stack.push((cursor.clone(), 0, 1));
274275
})?;
275276
let Some(bcp47_id) = self.data.bcp47_ids.get(trie_value.index()) else {
@@ -281,6 +282,9 @@ impl<'a> TimeZoneIdMapperBorrowed<'a> {
281282
}
282283
// If we get here, we need to walk the trie to find the canonical IANA ID.
283284
let needle = trie_value.to_canonical();
285+
if !string.contains('/') {
286+
string.to_mut().insert(0, '_');
287+
}
284288
let Some(string) = self.iana_search(needle, string.into_owned(), stack) else {
285289
debug_assert!(false, "every time zone should have a canonical IANA ID");
286290
return None;
@@ -332,7 +336,15 @@ impl<'a> TimeZoneIdMapperBorrowed<'a> {
332336
/// Queries the data for `iana_id` without recording the normalized string.
333337
/// This is a fast, no-alloc lookup.
334338
fn iana_lookup_quick(&self, iana_id: impl AsRef<[u8]>) -> Option<IanaTrieValue> {
335-
self.data.map.get(iana_id).map(IanaTrieValue)
339+
let mut cursor = self.data.map.cursor();
340+
let iana_id = iana_id.as_ref();
341+
if !iana_id.contains(&b'/') {
342+
cursor.step(NON_REGION_CITY_PREFIX);
343+
}
344+
for &b in iana_id {
345+
cursor.step(b);
346+
}
347+
cursor.take_value().map(IanaTrieValue)
336348
}
337349

338350
/// Queries the data for `iana_id` while keeping track of the normalized string.
@@ -343,6 +355,10 @@ impl<'a> TimeZoneIdMapperBorrowed<'a> {
343355
mut cursor_fn: impl FnMut(&ZeroAsciiIgnoreCaseTrieCursor<'l>),
344356
) -> Option<(IanaTrieValue, Cow<'s, str>)> {
345357
let mut cursor = self.data.map.cursor();
358+
if !iana_id.contains('/') {
359+
cursor_fn(&cursor);
360+
cursor.step(NON_REGION_CITY_PREFIX);
361+
}
346362
let mut string = Cow::Borrowed(iana_id);
347363
let mut i = 0;
348364
let trie_value = loop {
@@ -467,13 +483,13 @@ impl TimeZoneIdMapperWithFastCanonicalization<TimeZoneIdMapper> {
467483
#[cfg(feature = "compiled_data")]
468484
pub fn new() -> Self {
469485
const _: () = assert!(
470-
crate::provider::Baked::SINGLETON_IANA_TO_BCP47_MAP_V2_MARKER.bcp47_ids_checksum
486+
crate::provider::Baked::SINGLETON_IANA_TO_BCP47_MAP_V3_MARKER.bcp47_ids_checksum
471487
== crate::provider::Baked::SINGLETON_BCP47_TO_IANA_MAP_V1_MARKER.bcp47_ids_checksum,
472488
);
473489
Self {
474490
inner: TimeZoneIdMapper {
475491
data: DataPayload::from_static_ref(
476-
crate::provider::Baked::SINGLETON_IANA_TO_BCP47_MAP_V2_MARKER,
492+
crate::provider::Baked::SINGLETON_IANA_TO_BCP47_MAP_V3_MARKER,
477493
),
478494
},
479495
data: DataPayload::from_static_ref(
@@ -495,7 +511,7 @@ impl TimeZoneIdMapperWithFastCanonicalization<TimeZoneIdMapper> {
495511
#[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new)]
496512
pub fn try_new_unstable<P>(provider: &P) -> Result<Self, DataError>
497513
where
498-
P: DataProvider<IanaToBcp47MapV2Marker> + DataProvider<Bcp47ToIanaMapV1Marker> + ?Sized,
514+
P: DataProvider<IanaToBcp47MapV3Marker> + DataProvider<Bcp47ToIanaMapV1Marker> + ?Sized,
499515
{
500516
let mapper = TimeZoneIdMapper::try_new_unstable(provider)?;
501517
Self::try_new_with_mapper_unstable(provider, mapper)
@@ -538,7 +554,7 @@ where
538554
#[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new)]
539555
pub fn try_new_with_mapper_unstable<P>(provider: &P, mapper: I) -> Result<Self, DataError>
540556
where
541-
P: DataProvider<IanaToBcp47MapV2Marker> + DataProvider<Bcp47ToIanaMapV1Marker> + ?Sized,
557+
P: DataProvider<IanaToBcp47MapV3Marker> + DataProvider<Bcp47ToIanaMapV1Marker> + ?Sized,
542558
{
543559
let data = provider.load(Default::default())?.payload;
544560
Self {
@@ -551,7 +567,7 @@ where
551567
fn validated(self) -> Result<Self, DataError> {
552568
if self.inner.as_ref().data.get().bcp47_ids_checksum != self.data.get().bcp47_ids_checksum {
553569
return Err(
554-
DataErrorKind::InconsistentData(IanaToBcp47MapV2Marker::INFO)
570+
DataErrorKind::InconsistentData(IanaToBcp47MapV3Marker::INFO)
555571
.with_marker(Bcp47ToIanaMapV1Marker::INFO),
556572
);
557573
}

components/timezone/src/provider.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const _: () = {
4343
}
4444
make_provider!(Baked);
4545
impl_bcp47_to_iana_map_v1_marker!(Baked);
46-
impl_iana_to_bcp47_map_v2_marker!(Baked);
46+
impl_iana_to_bcp47_map_v3_marker!(Baked);
4747
impl_metazone_period_v1_marker!(Baked);
4848
};
4949

@@ -52,7 +52,7 @@ const _: () = {
5252
pub const MARKERS: &[DataMarkerInfo] = &[
5353
MetazonePeriodV1Marker::INFO,
5454
names::Bcp47ToIanaMapV1Marker::INFO,
55-
names::IanaToBcp47MapV2Marker::INFO,
55+
names::IanaToBcp47MapV3Marker::INFO,
5656
];
5757

5858
/// TimeZone ID in BCP47 format

components/timezone/src/provider/names.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ pub struct IanaToBcp47MapV1<'data> {
5050
pub bcp47_ids_checksum: u64,
5151
}
5252

53+
/// [`IanaToBcp47MapV3`]'s trie cannot handle differently-cased prefixes, like `Mexico/BajaSur`` and `MET`.
54+
/// Therefore, any ID that is not of the shape `{region}/{city}` gets prefixed with this character
55+
/// inside the trie.
56+
///
57+
/// During lookup, if the input is not of the shape `{region}/{city}`, the trie cursor has to be advanced over
58+
/// this byte.
59+
pub const NON_REGION_CITY_PREFIX: u8 = b'_';
60+
5361
/// A mapping from normal-case IANA time zone identifiers to BCP-47 time zone identifiers.
5462
///
5563
/// Multiple IANA time zone IDs can map to the same BCP-47 time zone ID.
@@ -61,14 +69,14 @@ pub struct IanaToBcp47MapV1<'data> {
6169
/// </div>
6270
#[derive(Debug, Clone, PartialEq)]
6371
#[icu_provider::data_struct(marker(
64-
IanaToBcp47MapV2Marker,
65-
"time_zone/iana_to_bcp47@2",
72+
IanaToBcp47MapV3Marker,
73+
"time_zone/iana_to_bcp47@3",
6674
singleton
6775
))]
6876
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
6977
#[cfg_attr(feature = "datagen", databake(path = icu_timezone::provider::names))]
7078
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
71-
pub struct IanaToBcp47MapV2<'data> {
79+
pub struct IanaToBcp47MapV3<'data> {
7280
/// A map from normal-case IANA time zone identifiers to indexes of BCP-47 time zone
7381
/// identifiers along with a canonical flag. The IANA identifiers are normal-case.
7482
///

provider/data/calendar/Cargo.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/calendar/README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/calendar/src/lib.rs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/casemap/Cargo.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/casemap/README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/casemap/src/lib.rs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/collator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/collator/README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/collator/data/collation_diacritics_v1_marker.rs.data

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)