-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,51 @@ | ||
# Rust Translation App | ||
# rust-translation | ||
|
||
This Rust application demonstrates how to translate text using the Google Translate API. | ||
A simple Rust crate for text translation between languages. | ||
|
||
## Prerequisites | ||
## Overview | ||
|
||
- Rust: Make sure you have Rust installed on your system. You can download it from [here](https://www.rust-lang.org/tools/install). | ||
`rust-translation` is a lightweight and easy-to-use Rust crate that simplifies the process of translating text into different languages using the Google Translate service. | ||
|
||
## Features | ||
|
||
- Seamless translation of text into multiple languages. | ||
- Support for translating to and from English. | ||
- Simple and intuitive API. | ||
|
||
## Installation | ||
|
||
Add `rust-translation` to your `Cargo.toml` file: | ||
|
||
```toml | ||
[dependencies] | ||
rust-translation = "0.1.0" | ||
``` | ||
|
||
## Usage | ||
|
||
```rust | ||
use rust_translation::{translate, translate_to_english, translate_from_english}; | ||
|
||
#[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); | ||
} | ||
``` | ||
|
||
## 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](LICENSE) file for details. |