| Crates.io | lingual |
| lib.rs | lingual |
| version | 1.1.0 |
| created_at | 2023-07-06 00:08:01.435712+00 |
| updated_at | 2024-01-27 03:06:50.376931+00 |
| description | Free and Unlimited Language Translation (Google) API for Rust. Supports Async and Sync. |
| homepage | https://github.com/deepp0925/lingual |
| repository | https://github.com/deepp0925/lingual |
| max_upload_size | |
| id | 909467 |
| size | 32,013 |
Provides google translation api for Rust.
The crate uses reqwest to make http calls and by default uses async/await syntax.
Support for wasm is included and will be enabled implicitly if when the target_arch is wasm32.
use lingual::{translate, Langs, Translator}
let translator = Translator::default();
let translation = translator.translate("Hello World", Lang::Auto, Langs::Es).await.unwrap();
assert_eq!("Hola Mundo", translation.text());
If you prefer to use regular sync version, simply include blocking feature in your Cargo.toml file.
It will be the same code as above with the exception of await keyword.
lingual = {version = "...", features = ["blocking"]}
blocking - uses blocking/sync api for fetching the translations.