23 releases (stable)

1.5.0 May 28, 2024
1.4.1 Dec 19, 2023
1.4.0 Nov 17, 2023
1.2.5 Apr 25, 2023
0.4.1 Nov 10, 2021

#401 in Internationalization (i18n)

Download history 185/week @ 2024-07-17 240/week @ 2024-07-24 248/week @ 2024-07-31 280/week @ 2024-08-07 334/week @ 2024-08-14 192/week @ 2024-08-21 129/week @ 2024-08-28 332/week @ 2024-09-04 305/week @ 2024-09-11 192/week @ 2024-09-18 202/week @ 2024-09-25 179/week @ 2024-10-02 203/week @ 2024-10-09 133/week @ 2024-10-16 170/week @ 2024-10-23 203/week @ 2024-10-30

737 downloads per month
Used in leptos_i18n_build

Unicode-3.0

13MB
104K SLoC

icu_datagen crates.io

icu_datagen is a library to generate data files that can be used in ICU4X data providers.

Data files can be generated either programmatically (i.e. in build.rs), or through a command-line utility.

Also see our datagen tutorial.

Examples

Rust API

use icu_datagen::blob_exporter::*;
use icu_datagen::prelude::*;
use std::fs::File;

DatagenDriver::new()
    .with_keys([icu::list::provider::AndListV1Marker::KEY])
    .with_locales_and_fallback([LocaleFamily::FULL], Default::default())
    .export(
        &DatagenProvider::new_latest_tested(),
        BlobExporter::new_v2_with_sink(Box::new(
            File::create("data.postcard").unwrap(),
        )),
    )
    .unwrap();

Command line

The command line interface can be installed through Cargo.

$ cargo install icu_datagen

Once the tool is installed, you can invoke it like this:

$ icu4x-datagen --keys all --locales de en-AU --format blob --out data.postcard

More details can be found by running --help.

Cargo features

This crate has a lot of dependencies, some of which are not required for all operating modes. These default Cargo features can be disabled to reduce dependencies:

  • baked_exporter
    • enables the baked_exporter module
    • enables the --format mod CLI argument
  • blob_exporter
  • fs_exporter
  • networking
    • enables methods on DatagenProvider that fetch source data from the network
    • enables the --cldr-tag, --icu-export-tag, and --segmenter-lstm-tag CLI arguments that download data
  • rayon
    • enables parallelism during export
  • use_wasm / use_icu4c
  • bin
    • required by the CLI and enabled by default to make cargo install work
  • legacy_api
    • enables the deprecated pre-1.3 API
    • enabled by default for semver stability
    • will be removed in 2.0.
  • icu_experimental
    • enables data generation for keys defined in the unstable icu_experimental crate
    • note that this features affects the behaviour of all_keys

The meta-feature experimental_components is available to activate all experimental components.

More Information

For more information on development, authorship, contributing etc. please visit ICU4X home page.

Dependencies

~5–17MB
~176K SLoC