diff --git a/crates/i18n/src/lib.rs b/crates/i18n/src/lib.rs index 718af8c..d84463b 100644 --- a/crates/i18n/src/lib.rs +++ b/crates/i18n/src/lib.rs @@ -11,6 +11,8 @@ //! //! * i18n_pattern-rizzen-yazston //! +//! * i18n_message-rizzen-yazston +//! //! # Usage //! //! For most use cases, just the use of `i18n-rizzen-yazston` crate will be sufficient to use the multilingual message @@ -21,7 +23,7 @@ //! ``` //! [dependencies] //! icu_locid = "1.0.0" -//! i18n-rizzen-yazston = "0.3.1" +//! i18n-rizzen-yazston = "0.4.0" //! ``` //! //! ## Examples @@ -29,6 +31,6 @@ //! See the various component crates for usage examples. pub use i18n_lstring-rizzen-yazston as lstring; -pub use i18n_lexer-rizzen-yazston as lexer; +pub use i18n_lexer-rizzen-yazston as pattern; pub use i18n_pattern-rizzen-yazston as pattern; -//pub use i18n_message-rizzen-yazston as message; +pub use i18n_message-rizzen-yazston as message; diff --git a/crates/message/Cargo.toml b/crates/message/Cargo.toml index 7bcaaee..e1efe70 100644 --- a/crates/message/Cargo.toml +++ b/crates/message/Cargo.toml @@ -27,6 +27,8 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +icu_locid = "1.0.0" +i18n_lstring-rizzen-yazston = { version = "0.3.0", path = "../lstring" } i18n_lexer-rizzen-yazston = { version = "0.3.0", path = "../lexer" } # Needed for Token, TokenType i18n_pattern-rizzen-yazston = { version = "0.3.0", path = "../pattern" } tree-rizzen-yazston = { version = "0.2.0", path = "../../../tree" } diff --git a/crates/message/src/formatter.rs b/crates/message/src/formatter.rs new file mode 100644 index 0000000..96baa53 --- /dev/null +++ b/crates/message/src/formatter.rs @@ -0,0 +1,70 @@ +// This file is part of `i18n_message-rizzen-yazston` crate. For the terms of use, please see the file +// called `LICENSE-BSD-3-Clause` at the top level of the `i18n_message-rizzen-yazston` crate. + +//! TODO: Complete crate description +//! +//! # Examples +//! +//! ``` +//! // TODO: crate example +//! ``` + +use icu_locid::Locale; +use std::rc::Rc; +use i18n_lstring::LString; +use i18n_lexer::{Lexer, Token, TokenType}; +use tree::{Tree, NodeFeatures}; +use i18n_pattern::{NodeType, parse}; +use std::collections::HashMap; +//use std::fmt; this is needed if implementing Display on something + +pub struct System { + lexer: Lexer, +} + +impl System { + pub fn try_new( lexer: Lexer ) -> Result { + + } +} + +pub struct Formatter { + locale: Rc, + ast: Tree, +} + +impl Formatter { + + /// Creates a Formatter for the language string. + pub fn try_new( string: LString ) -> Result { + Err( "Temporary error until implemented.".to_string() ) + } + + /// Format the language string with supplied values. + pub fn format( self ) -> Result { + Err( "Temporary error until implemented.".to_string() ) + } + + +} + + + + + + + +#[cfg(test)] +mod tests { + use super::*; + use icu_testdata::buffer; + + #[test] + fn test1() { + } + + #[test] + fn test2() { + } +} + diff --git a/crates/message/src/lib.rs b/crates/message/src/lib.rs index 02e3a6f..182a294 100644 --- a/crates/message/src/lib.rs +++ b/crates/message/src/lib.rs @@ -1,32 +1,11 @@ // This file is part of `i18n_message-rizzen-yazston` crate. For the terms of use, please see the file -// called `LICENSE-BSD-3-Clause` at the top level of the `i18n_message-rizzen-yazston` crate. +// called LICENSE-BSD-3-Clause at the top level of the `i18n_message-rizzen-yazston` crate. -//! TODO: Complete crate description -//! -//! # Examples -//! -//! ``` -//! // TODO: crate example -//! ``` - -use i18n_lexer::{Lexer, Token, TokenType}; -use std::rc::Rc; -use tree::{Tree, NodeFeatures}; -use i18n_pattern::{NodeType, parse}; -use std::collections::HashMap; -//use std::fmt; this is needed if implementing Display on something - -#[cfg(test)] -mod tests { - use super::*; - use icu_testdata::buffer; - - #[test] - fn test1() { - } - - #[test] - fn test2() { - } -} +//! The `i18n_message` crate contains the messaging system. +//! +//! Contains the follow modules: +//! +//! * `formatter`: Takes an AST with supplied values to create a language string of the specified `Locale`. +pub mod formatter; +pub use formatter::*;