DeepL Api
Interact with DeepL API with typed wrapper.
Usage
[]
= "0.1.0"
use ;
let api = new;
// Source lang is optional
let translated = api.translate.await.unwrap;
assert!;
let sentences = translated.translations;
assert_eq!;
Interact with DeepL API with typed wrapper.
[dependencies]
deepl = "0.1.0"
use deepl::{DeepLApi, Lang};
let api = DeepLApi::new("YOUR AUTH KEY");
// Source lang is optional
let translated = api.translate("Hello World", Some(Lang::EN), Lang::ZH).await.unwrap();
assert!(!translated.translations.is_empty());
let sentences = translated.translations;
assert_eq!(sentences[0].text, "你好,世界");