rustlate/
lib.rs

1mod translator;
2pub use translator::*;
3
4/// Translates the text with shotcut.
5///
6/// # Arguments
7///
8/// * `text` - The string slice text will be translated.
9/// * `to` - The string slice language will be converted to.
10///
11/// # Examples
12///
13/// ```
14/// fn main() {
15///     println!("{:?}", rustlate::translate_auto("hello", "tr"));
16/// }
17/// ```
18pub fn translate_auto(text: &str, to: &'static str) -> Result<String, String> {
19    let translator_struct = Translator{
20        to: to,
21        from: "auto"
22    };
23
24    translator_struct.translate(text)
25}