| Crates.io | google_translate_request |
| lib.rs | google_translate_request |
| version | 1.0.0 |
| created_at | 2024-12-28 21:09:14.701983+00 |
| updated_at | 2024-12-28 21:09:14.701983+00 |
| description | Google translate request to a spesific endpoint |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1497794 |
| size | 43,562 |
Google has this url:
https://translate.googleapis.com/translate_a/single?client=gtx&sl=(INSERT ORIGINAL LANGUAGE)&tl=(INSERT TARGET LANGUAGE)&dt=t&q=(INSERT TEXT HERE)
Which is used for translating text. This package is simply a wrapper for that URL.
async fn test_translate() {
let text = "Hello, world!";
let from = "en";
let to = "zh-CN";
let resp = translate(text, from, to).await.unwrap();
println!("{}", resp);
}
this package is so small that it contains more testing code than actual code. If you're not using reqwest or if you have any modification needs, it's better to write your own code than use this.
However, this package is useful for anyone with the same need as me, which is a simple translation package that can be learned in a couple of minutes, and won't require any prior knowlage about google.