Skip to content

A simple Rust crate for text translation between languages using Google Translate API

License

Notifications You must be signed in to change notification settings

Mintype/rust-translate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-translate

A simple Rust crate for text translation between languages.

Overview

rust-translate is a easy-to-use Rust crate that simplifies the process of translating text into different languages using the Google Translate API.

Features

  • Seamless translation of text into multiple languages.
  • Support for translating to and from English.
  • Simple and intuitive API.

Installation

Add rust-translate and tokio to your Cargo.toml file:

[dependencies]
rust-translate = "X.X.X"
tokio = { version = "1.0", features = ["full"] }

Add the latest version of rust-translate with cargo add rust-translate.

Usage

use rust_translate::{translate, translate_to_english, translate_from_english};
use rust_translate::supported_languages::get_languages;
#[tokio::main]
async fn main() {
    // Translate text from any language to any other language
    let translated_text = translate("Bonjour le monde!", "fr", "en").await.unwrap();
    println!("Translated text: {}", translated_text);

    // Translate text to English
    let english_text = translate_to_english("Bonjour le monde!").await.unwrap();
    println!("Translated to English: {}", english_text);

    // Translate text from English to any other language
    let spanish_text = translate_from_english("Hello, world!", "es").await.unwrap();
    println!("Translated to Spanish: {}", spanish_text);

    // List the supported languages of the crate
    let supported_languages = get_languages();
    println!("Supported languages: {:?}", supported_languages);
}

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Crates.io

You can find this crate and the latest version on crates.io.

About

A simple Rust crate for text translation between languages using Google Translate API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages