Skip to content

Releases: unicode-org/icu4x

ICU4X 0.3.0 (July 30, 2021)

02 Aug 18:58
Compare
Choose a tag to compare
Pre-release

ICU4X 0.3.0 contains major improvements to the data pipeline, as well as bug fixes and feature work.

  • Static data provider without filesystem dependency (#78)
  • Infrastructure around zero-copy deserialization, including ZeroVec and Yoke (#652, #667)
  • Most ICU4X components support no_std (#812)
  • Hour cycle preferences are used by DateTimeFormat (#671)
  • Skeleton matching supports additional field widths (#584)
  • Add canonicalize method to LocaleCanonicalizer (#747)
  • Added range iterator on UnicodeSet (#836)
  • Add PluralRules::categories() function (#789)
  • Consolidated data generation tool into new binary icu4x-datagen

ICU4X 0.2.0 (April 29, 2021)

29 Apr 16:14
dc4accf
Compare
Choose a tag to compare
Pre-release
  • Updated CLDR to 39 (#640)
  • Initial release of:
    • icu_decimal (#590)
    • icu_locale_canonicalizer (#417)
  • DateTimeFormat gets support for
    • day periods (#435)
    • time zones (#418)
    • components bag (#481)
  • UnicodeSet gets preliminary support for L3a subset (#478)
  • PluralRules support E operand (#407)
  • New utilities:
    • Writeable
    • ZeroVec
    • LiteMap
    • FixedDecimal
    • Pattern
  • Early prototype of C API - icu_capi

See 0.2 release blog post for details.

ICU4X 0.1.0 (October 15, 2020)

15 Oct 15:44
Compare
Choose a tag to compare
Pre-release

Announcing ICU4X 0.1 Release

The first development release of ICU4X, version 0.1, is now available.

ICU4X is a project that aims to bring modern internationalization API components to client-side and resource constrained environments

ICU4X is written in Rust programming language and aims to provide high quality internationalization components with a focus on

  • Modularity
  • Flexible data management
  • Performance, memory, safety and size
  • Universal access from programming languages and ecosystems (FFI)

You can read more about the project in its introduction post.

Scope

The 0.1 release of the project is unstable.

It means that the release is intended for testing, not production, and no API or data model stability guarantees are being provided as of yet.

We hope to get feedback from the Internationalization Community and Rust Community on API, algorithms, performance, and alignment with consuming environments.
To read more about ways to contribute, visit the project’s CONTRIBUTING document.

For 0.1 release, we focused on laying out the foundation for the project.

Data Provider

Data Provider is the core API for managing data such as CLDR and Unicode and will be used by most of the ICU4X components.

In the 0.1 release ICU4X exposes the features allowing the APIs to read data from CLDR JSON resources and ICU4X resources in a synchronous fashion from the file system.

Language and Locale Identifiers

At the core of all internationalization operations are identifiers for language and locale selections. They allow us to manage data, and negotiate between locales that the user prefers and available resources.

In 0.1 ICU4X provides core APIs for parsing, managing and serializing them.

use icu::locid::LanguageIdentifier;

let li: LanguageIdentifier = "eN_latn_Us-Valencia".parse()
    .expect("Failed to parse a language identifier.");

assert_eq!(li.language.as_str(), "en");
assert_eq!(li.script.map(|s| s.to_string()), Some("Latn".into()));
assert_eq!(li.region.map(|r| r.to_string()), Some("US".into()));
assert_eq!(li.variants.get(0).map(|v| v.to_string()), Some("valencia".into()));

Code Examples | Documentation

Unicode Set

For the second component we selected a Unicode Set, which is an API that allows for management of Unicode characters such as locale-aware white spaces, characters from different alphabets and so on.

This API is very low level and will serve as a foundation for many algorithms around text parsing, text layout, selection and so on.

use icu::uniset::UnicodeSetBuilder;

let ranges = vec!['A'..='Z', 'a'..='z'];

let mut builder = UnicodeSetBuilder::new();

for range in &ranges {
    builder.add_range(range);
}

let set = builder.build();

assert_eq!(set.contains('c'), true);
assert_eq!(set.contains('0'), false);
assert_eq!(set.contains_range(&('C'..='L')), true);
assert_eq!(set.contains_range(&('0'..='2')), false);

Code Examples | Documentation

Plural Rules

The third component is enabling pluralization which is another foundational feature used by other APIs later on. This API is also necessary for localization systems and is the first to use the DataProvider API.

use icu::plurals::{PluralRules, PluralRuleType, PluralCategory};
use icu::locid::macros::langid;
use icu_provider_fs::FsDataProvider;

let lid = langid!("fr");
let provider = FsDataProvider::try_new("./icu4x-data/")
    .expect("Failed to initialize Data Provider");

let pr = PluralRules::try_new(lid, &provider, PluralRuleType::Cardinal)
    .expect("Failed to construct Plural Rules.");

assert_eq!(pr.select(5_usize), PluralCategory::Other);

Code Examples | Documentation

Date & Time Format

The final component is the first high-level component and one of the most commonly requested internationalization APIs - Date and Time Formatting.

In the 0.1 release the API is very simple and handles just a basic set of style options. Despite that, it should be sufficient to format date and time for most common use cases.

use icu::datetime::{DateTimeFormat, date::MockDateTime, options::style};
use icu::locid::macros::langid;
use icu_provider_fs::FsDataProvider;

let lid = langid!("es-AR");
let date: MockDateTime = "2020-09-18T00:00:00".parse()
    .expect("Failed to parse a date");

let provider = FsDataProvider::try_new("./icu4x-data/")
    .expect("Failed to initialize Data Provider");

let options = style::Bag {
    date: Some(style::Date::Medium),
    time: None,
    preferences: None
}.into();

let dtf = DateTimeFormat::try_new(lid, &provider, &options)
    .expect("Failed to initialize DateTimeFormat");

assert_eq!(dtf.format(&date).to_string(), "18 sep. 2020");

Code Example | Documentation

Try it

ICU4X 0.1 is available from the project's github repository and via crates.io.

To test it, the user can follow the Introduction Tutorial, and read through examples attached to each component.

As mentioned at the beginning, this is an unstable release as the version number suggests and we are looking for early adopters and testers as we work on maturing the APIs toward a stable 1.0 release.

Contribute

You can read more about the exact design, scope and goals of the project in our charter definition document.

If you find ICU4X interesting, we'd encourage you to consider contributing to the project.

You can be part of the team that is developing the project. Designing and implementing a modern internationalization components using Rust and targeting wide range of platforms is an exciting challenge!
Your contributions to architecture, implementation, testing or documentation can help to bring this project to version 1.0 as quickly as possible.
This is your opportunity to dramatically improve the ability of client side software to reach its global audience..

You can find more information in the CONTRIBUTING.md document in our github repository.