Crate deepl

source ·
Expand description

deepl-rs

Deepl-rs is a simple wrapper for providing simple function to make request to the DeepL API endpoint and typed response.

This is still a incomplete library, please open a issue on GitHub to tell me what feature you want.

Usage

  • Basic Translation
use deepl::DeepLApi

let api = DeepLApi::new("Your DeepL Token", false); // set second param to true if you are pro user
let response = api.translate("Hello World", None, Lang::ZH).await.unwrap();
let translated_results = response.translations;

assert_eq!(translated_results[0].text, "你好,世界");
assert_eq!(translated_results[0].detected_source_language, Lang::EN);

License

This project is licensed under MIT license.

Structs

A struct that contains necessary data
Response from basic translation API
Response from api/v2/document/$ID
Response from api/v2/document
Translated result for a sentence
Configure how to upload the document to DeepL API.
Reponse from the usage API

Enums

Possible value of the document translate status
Representing error during interaction with DeepL
Available language code for source and target text