Crate i18n_pattern

source ·
Expand description

Parsing of string tokens into an Abstract Syntax Tree (AST), checking the grammar of patterns is valid. The parser only does the syntactic analysis of the supplied Token vector.

The formatter takes the Abstract Syntax Tree (AST) that was generated by the parser and constructs a string template for values to be substituted into. The formatter also does the semantic analysis of the grammar. Once a string template has been constructed, it can be used multiple times by simply supplying new placeholder values when executing the format() method. Depending on the placeholder type of the pattern, a suitable selection of the available data types can be used, these include the basic String, integers, unsigned integers and floats. In addition to these special ICU4X types are supported such as FixedDecimal, Date, Time and DateTime structs.

See pattern strings.asciidoc in docs of pattern for the pattern formatting specification.

§Features

Available features for i18n_pattern crate:

  • compiled_data (Preferred): Enable the compiled_data feature on i18n_icu. Allow for the internal data of the various ICU4X components.

  • blob: Enable the blob feature on i18n_icu. Allow for instances of BlobDataProvider to be used various ICU4X components that supports BufferProvider.

  • fs: Enable the fs feature on i18n_icu. Allow for instances of FsDataProvider to be used various ICU4X components that supports BufferProvider.

  • sync: Allow for rust’s concurrency capabilities to be used. Use of Arc and Mutex instead Rc and RefCell.

  • log: To provide some logging information.

Re-exports§

Modules§