[][src]Crate translate_core

Translate is the first translation crate in Rust This crate is based on Google and Yandex translators The langage detection is also supported

Requirements:

  • An internet connection
  • OpenSSL

Warning:

  • This crate use reqwest

Functionnalities:

  • Langage detection (supports: [EN,DE,FR,ES,IT,NL,RU])
  • Translation (supports: [EN,DE,FR,ES,IT,NL,RU])

Examples:

use translate::*;
translate(google(),"This is an test for the translation".to_string(),Langage::EN,Langage::FR,|result| {
    println!("{}",result.unwrap());
});
use translate::*;
detect(yandex(),"This is an test for the detection".to_string(),|result| {
    println!("{}",result.unwrap());
});

Structs

Google
Yandex

Enums

Langage

The langage Enum which has:

Traits

EDetect

Trait for langage Detection

ETranslate

Trait for text Translation

Functions

detect

This function detect the langage of a text. Actually only Yandex as the EDetect trait implemented You need to pass arguments: (,<text: String>,<The callback function which take an Option parameter)

google
string_to_langage

Convert lang code like EN, FR in lower of upper case to a Langage:: Supported langs: [EN, FR, DE, ES, NL, IT, RU]

translate

This function translate a text from the first langage to the second. Actually Google and Yandex as the ETranslate trait implemented You need to pass arguments: (,<text: String>,<srclang: Langage>,<outlang: Langage>,<The callback function which take an Option parameter)

yandex