created_at2023-07-06 17:06:30.248611
updated_at2024-02-03 15:49:38.719359
descriptionThe `i18n_pattern` crate of the Internationalisation project.
Rizzen (rizzen-yazston)



= i18n_pattern Rizzen Yazston

== Pattern parser and formatter

The parser handles the 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 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 crate for the pattern formatting specification.

== Features

Available features for i18n_icu 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}[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.

== Acknowledgement

Stefano Angeleri for advice on various design aspects of implementing the components of the internationalisation project, and also providing the Italian translation of error message strings.

Commit count: 82

cargo fmt