Expand description

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.

Examples

build.rs

use icu_datagen::*;
use icu_locid::langid;
use std::fs::File;
use std::path::PathBuf;

fn main() {
    icu_datagen::datagen(
        Some(&[langid!("de"), langid!("en-AU")]),
        &icu_datagen::keys(&["list/and@1"]),
        &SourceData::default(),
        vec![Out::Blob(Box::new(File::create("data.postcard").unwrap()))],
    )
    .unwrap();
}

Command line

The command line interface is available with the bin feature.

cargo run --features bin -- \
    --icu_exports-root /path/to/icu_exports/root \
    --all-keys \
    --locales de,en-AU \
    --format blob \
    --out data.postcard

More details can be found by running --help.

Structs

Bag of options for datagen source data.

Enums

Specifies a variant of CLDR JSON

Specifies the collation Han database to use.

The output format.

Functions

List of all supported keys

Runs ICU4X datagen.

Identifies errors that are due to missing CLDR data.

Identifies errors that are due to missing ICU export data.

Parses a list of human-readable key identifiers and returns a list of DataKeys.

Parses a compiled binary and returns a list of used DataKeys used by it.

Parses a file of human-readable key identifiers and returns a list of DataKeys.