Skip to content

Commit

Permalink
Merge branch 'main' into lazysource
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Jan 6, 2023
2 parents 11daf7f + 7dbe676 commit 52259bf
Show file tree
Hide file tree
Showing 55 changed files with 892 additions and 547 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ ffi/diplomat/cpp/docs/** linguist-generated=true
ffi/diplomat/js/include//** linguist-generated=true
ffi/diplomat/js/docs/** linguist-generated=true
*.rs.data linguist-language=Rust
*/**/README.md linguist-generated=true
2 changes: 2 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,8 @@ jobs:
# Binary size benchmark: build and size wasm binaries; creates ndjson output data format

binsize:
# TODO(https://github.com/unicode-org/icu4x/issues/2953): Fix this
if: false
strategy:
fail-fast: false
matrix:
Expand Down
27 changes: 23 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions components/calendar/src/week_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ pub fn week_of(

/// Computes & returns the week of given month or year according to a calendar with min_week_days = 1.
///
/// Does not know anything about the unit size (month or year), and will just assume the date falls
/// within whatever unit that is being considered. In other words, this function returns strictly increasing
/// values as `day` increases, unlike [`week_of()`] which is cyclic.
///
/// # Arguments
/// - first_weekday: The first day of a week.
/// - day: 1-based day of the month or year.
Expand All @@ -320,10 +324,10 @@ pub fn simple_week_of(first_weekday: IsoWeekday, day: u16, week_day: IsoWeekday)
#[allow(clippy::unwrap_used)] // week_of should can't fail with MIN_UNIT_DAYS
week_of(
&calendar,
// The duration of the current and previous unit does not influence the result if min_week_days = 1
// The duration of the previous unit does not influence the result if min_week_days = 1
// so we only need to use a valid value.
MIN_UNIT_DAYS,
MIN_UNIT_DAYS,
u16::MAX,
day,
week_day,
)
Expand Down Expand Up @@ -597,9 +601,8 @@ fn test_simple_week_of() {
);

// The 1st is a Monday and the week starts on Sundays.
// TODO(#2461): Enable this test
// assert_eq!(
// simple_week_of(IsoWeekday::Sunday, 26, IsoWeekday::Friday),
// 4
// );
assert_eq!(
simple_week_of(IsoWeekday::Sunday, 26, IsoWeekday::Friday),
4
);
}
2 changes: 1 addition & 1 deletion components/collator/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ pub enum BackwardSecondLevel {
/// # Unsupported BCP47 options
///
/// Reordering (BCP47 `kr`) currently cannot be set via the API and is implied
/// by the locale of the collation. `kr` is probihibited by ECMA 402.
/// by the locale of the collation. `kr` is prohibited by ECMA 402.
///
/// Normalization is always enabled and cannot be turned off. Therefore, there
/// is no option corresponding to BCP47 `kk`. `kk` is prohibited by ECMA 402.
Expand Down
2 changes: 1 addition & 1 deletion components/collator/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ fn test_region_fallback() {
fn test_reordering() {
let locale: Locale = langid!("bn").into();

// অ is Bengali
// অ is Bangla
// ऄ is Devanagari

{
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/fields/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum LengthError {
impl std::error::Error for LengthError {}

/// An enum representing the length of a field within a date or time formatting pattern string,
/// in which the pattern field is represented as a letter occuring 1 or more times in a row, ex:
/// in which the pattern field is represented as a letter occurring 1 or more times in a row, ex:
/// `MMM`, `dd`, `y`. See the
/// [LDML documentation in UTS 35](https://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns)
/// for more details.
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/options/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ pub enum TimeZoneName {
// UTS-35 fields: O, OOOO
// Per UTS-35: The long localized GMT format. This is equivalent to the "OOOO" specifier
// Per UTS-35: Short localized GMT format (e.g., GMT-8)
// This enum variant is combining the two types of fields, as the CLDR specifices the preferred
// This enum variant is combining the two types of fields, as the CLDR specifies the preferred
// hour-format for the locale, and ICU4X uses the preferred one.
// e.g.
// https://github.com/unicode-org/cldr-json/blob/c23635f13946292e40077fd62aee6a8e122e7689/cldr-json/cldr-dates-full/main/es-MX/timeZoneNames.json#L13
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/pattern/hour_cycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub(crate) fn naively_apply_preferences(
pattern: &mut runtime::Pattern,
preferences: &Option<preferences::Bag>,
) {
// If there is a preference overiding the hour cycle, apply it now.
// If there is a preference overriding the hour cycle, apply it now.
if let Some(preferences::Bag {
hour_cycle: Some(hour_cycle),
}) = preferences
Expand Down
8 changes: 4 additions & 4 deletions components/datetime/src/pattern/item/ule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::fields;
use core::convert::TryFrom;
use zerovec::ule::{AsULE, ZeroVecError, ULE};

/// `PatternItemULE` is a type optimized for efficent storing and
/// `PatternItemULE` is a type optimized for efficient storing and
/// deserialization of `TypedDateTimeFormatter` `PatternItem` elements using
/// `ZeroVec` model.
///
Expand Down Expand Up @@ -60,7 +60,7 @@ pub struct PatternItemULE([u8; 3]);

impl PatternItemULE {
/// Given the first byte of the three-byte array that `PatternItemULE` encodes,
/// the method determins whether the discriminant in
/// the method determines whether the discriminant in
/// the byte indicates that the array encodes the `PatternItem::Field`
/// or `PatternItem::Literal` variant of the `PatternItem`.
///
Expand Down Expand Up @@ -142,7 +142,7 @@ impl AsULE for PatternItem {
}
}

/// `GenericPatternItemULE` is a type optimized for efficent storing and
/// `GenericPatternItemULE` is a type optimized for efficient storing and
/// deserialization of `TypedDateTimeFormatter` `GenericPatternItem` elements using
/// the `ZeroVec` model.
///
Expand Down Expand Up @@ -195,7 +195,7 @@ pub struct GenericPatternItemULE([u8; 3]);

impl GenericPatternItemULE {
/// Given the first byte of the three-byte array that `GenericPatternItemULE` encodes,
/// the method determins whether the discriminant in
/// the method determines whether the discriminant in
/// the byte indicates that the array encodes the `GenericPatternItem::Field`
/// or `GenericPatternItem::Literal` variant of the `GenericPatternItem`.
///
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/pattern/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use icu_provider::{yoke, zerofrom};
pub use item::{GenericPatternItem, PatternItem};

/// The granularity of time represented in a pattern item.
/// Ordered from least granular to most granular for comparsion.
/// Ordered from least granular to most granular for comparison.
#[derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, yoke::Yokeable, zerofrom::ZeroFrom,
)]
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/provider/calendar/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct TimeSymbolsV1<'data> {
pub day_periods: day_periods::ContextsV1<'data>,
}

/// String data for the name, abbrevation, and narrow form of a date's era.
/// String data for the name, abbreviation, and narrow form of a date's era.
///
/// Keys of the map represent era codes, and the values are the display names.
///
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/src/skeleton/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const MAX_SKELETON_FIELDS: u32 = 10;

// > 2. For fields with symbols representing the same type (year, month, day, etc):
// > A. Most symbols have a small distance from each other.
// > - Months: M ≅ L (9 ≅ 9) conjuction, vs stand-alone
// > - Months: M ≅ L (9 ≅ 9) conjunction, vs stand-alone
// > Week: E ≅ c (Tue ≅ 2)
// > Period: a ≅ b ≅ B (am. ≅ mid. ≅ at night)
// > Hour: H ≅ k ≅ h ≅ K (23, 24, 12, 11)
Expand Down Expand Up @@ -93,7 +93,7 @@ fn naively_apply_time_zone_name(
pattern: &mut runtime::Pattern,
time_zone_name: &Option<components::TimeZoneName>,
) {
// If there is a preference overiding the hour cycle, apply it now.
// If there is a preference overriding the hour cycle, apply it now.
if let Some(time_zone_name) = time_zone_name {
runtime::helpers::maybe_replace_first(pattern, |item| {
if let PatternItem::Field(fields::Field {
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/time_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ impl FormatTimeZone for ExemplarCityFormat {
// Writes the unknown city "Etc/Unknown" for the current locale.
//
// If there is no localized form of "Etc/Unknown" for the current locale,
// returns the "Etc/Uknown" value of the `und` locale as a hard-coded string.
// returns the "Etc/Unknown" value of the `und` locale as a hard-coded string.
//
// This can be used as a fallback if [`exemplar_city()`](TimeZoneFormatter::exemplar_city())
// is unable to produce a localized form of the time zone's exemplar city in the current locale.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
},
"output": {
"values": {
"en": "week 1 of December"
"en": "week 5 of December"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion components/decimal/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/decimal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//!
//! # Examples
//!
//! ## Format a number with Bengali digits
//! ## Format a number with Bangla digits
//!
//! ```
//! use fixed_decimal::FixedDecimal;
Expand Down
12 changes: 11 additions & 1 deletion components/icu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ icu_plurals = { version = "1.0.0", path = "../plurals", default-features = false
icu_properties = { version = "1.0.0", path = "../properties", default-features = false }
icu_timezone = { version = "1.0.0", path = "../timezone", default-features = false }

# Experimental components
icu_casemapping = { version = "0.7.0", path = "../../experimental/casemapping", default-features = false, optional = true }
icu_segmenter = { version = "0.7.0", path = "../../experimental/segmenter", default-features = false, optional = true }
icu_displaynames = { version = "0.7.0", path = "../../experimental/displaynames", default-features = false, optional = true }
Expand Down Expand Up @@ -91,7 +92,16 @@ serde = [
serde_human = [
"icu_list/serde_human"
]
experimental = ["icu_casemapping", "icu_segmenter", "icu_datetime/experimental", "icu_displaynames", "icu_relativetime"]
icu_datetime_experimental = [
"icu_datetime/experimental",
]
experimental = [
"icu_casemapping",
"icu_datetime_experimental",
"icu_displaynames",
"icu_relativetime",
"icu_segmenter",
]

[[example]]
name = "tui"
Expand Down
8 changes: 4 additions & 4 deletions components/icu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
#[doc(inline)]
pub use icu_calendar as calendar;

#[cfg(feature = "experimental")]
#[cfg(feature = "icu_casemapping")]
#[doc(inline)]
pub use icu_casemapping as casemapping;

Expand Down Expand Up @@ -162,17 +162,17 @@ pub use icu_properties as properties;
#[doc(inline)]
pub use icu_collections as collections;

#[cfg(feature = "experimental")]
#[cfg(feature = "icu_segmenter")]
#[doc(inline)]
pub use icu_segmenter as segmenter;

#[doc(inline)]
pub use icu_timezone as timezone;

#[cfg(feature = "experimental")]
#[cfg(feature = "icu_displaynames")]
#[doc(inline)]
pub use icu_displaynames as displaynames;

#[cfg(feature = "experimental")]
#[cfg(feature = "icu_relativetime")]
#[doc(inline)]
pub use icu_relativetime as relativetime;
2 changes: 1 addition & 1 deletion components/timezone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ zerovec = { version = "0.9", path = "../../utils/zerovec", default-features = fa
databake = { version = "0.1.0", path = "../../utils/databake", optional = true, features = ["derive"] }

[dev-dependencies]
icu = { path = "../../components/icu", default-features = false, features = ["experimental"] }
icu = { path = "../../components/icu", default-features = false }
icu_testdata = { path = "../../provider/testdata", default-features = false, features = ["icu_timezone"] }
Loading

0 comments on commit 52259bf

Please sign in to comment.