translators 0.1.2

Free Google Translator, Deepl without API key and limits.
Documentation

translators Crates.io License

translators is an async/sync library for Google Translator, Deepl (soon) with no API key and no limits. It also includes support for proxy.

Questions:

  • There are no limits? Yes, I tested the translation of a book exceeding 1 million characters and uploaded the raw string into a single function without any issues.
  • What translation services are supported? Supports Google Translate and will soon Deepl.

Features flags

  • google - add support google-translate
  • tokio-async - add support async

Examples

1. Async example

use translators::{GoogleTranslator, Translator};

#[tokio::main]
async fn main() {
    let google_trans = GoogleTranslator::default();
    let res = google_trans
        .translate_async("Hello, world!", "", "es")
        .await
        .unwrap();
    println!("{res}");
}

Add to the dependency:

[dependencies]
translators = { version = "0.1.2", features = ["google", "tokio-async"] }
tokio = { version = "1.38.0", features = ["rt-multi-thread"] }

2. Sync example

use translators::{GoogleTranslator, Translator};

fn main() {
    let google_trans = GoogleTranslator::default();
    let res = google_trans
        .translate_sync("Hello, world!", "", "es")
        .unwrap();
    println!("{res}");
}

Add to the dependency:

[dependencies]
translators = { version = "0.1.2", features = ["google"] }

3. Proxy example

use translators::{GoogleTranslator, Translator};

fn main() {
    let google_trans = GoogleTranslator{
        timeout: 35, // How long to wait for a request
        delay: 0, // delay between each request
        proxy_address: Some("http://0.0.0.0:8080".to_string()), // or https or socks4 or socks5
    };
    let res = google_trans
        .translate_sync("Hello, world!", "", "es")
        .unwrap();
    println!("{res}");
}

Add to the dependency:

[dependencies]
translators = { version = "0.1.2", features = ["google"] }

What's New in Version 0.1.2

  • New feature flag "tokio-async"
  • Asynchronous request paralleling
  • Fixed the text slice

Additional Information

For more details, guides, and advanced usage, please refer to the examples and official documentation.