| Crates.io | yandex-translate-v2 |
| lib.rs | yandex-translate-v2 |
| version | 0.1.3 |
| created_at | 2026-01-08 16:46:31.838779+00 |
| updated_at | 2026-01-08 16:53:13.775112+00 |
| description | Yandex Translate API v2 client (and not only v2). |
| homepage | https://crates.io/crates/yandex-translate-v2 |
| repository | https://github.com/savannstm/yandex-translate-v2 |
| max_upload_size | |
| id | 2030681 |
| size | 66,063 |
Simple Yandex Translate API client vibe-coded by Claude.
cargo add yandex-translate-v2 # Blocking
cargo add yandex-translate-v2 --no-default-features -F "async" # Asynchronous
use yandex_translate_v2::{
AuthMethod,
TranslateRequest,
YandexTranslateClient,
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = YandexTranslateClient::with_api_key("YOUR_API_KEY")?;
let texts = ["Hello world", "How are you?"];
let request = TranslateRequest {
folder_id: "YOUR_FOLDER_ID",
texts: &texts,
target_language_code: "ru",
source_language_code: Some("en"),
};
let response = client.translate(&request)?;
for translation in response.translations {
println!("Translated: {}", translation.text);
if let Some(lang) = translation.detected_language_code {
println!("Detected language: {}", lang);
}
}
Ok(())
}
use yandex_translate_v2::{
TranslateRequest,
YandexTranslateClient,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = YandexTranslateClient::with_iam_token("YOUR_IAM_TOKEN")?;
let texts = ["Good morning", "Nice to meet you"];
let request = TranslateRequest {
folder_id: "YOUR_FOLDER_ID",
texts: &texts,
target_language_code: "de",
source_language_code: None, // let API detect language
};
let response = client.translate(&request).await?;
for translation in response.translations {
println!("Translated: {}", translation.text);
}
Ok(())
}
blocking - enabled by default. Uses blocking/synchronous requests.async - Uses asynchronous requests. Mutually exclusive with blocking.Project is licensed under WTFPL.