| Crates.io | rust-i18n-autotranslate |
| lib.rs | rust-i18n-autotranslate |
| version | 0.1.7 |
| created_at | 2026-01-11 12:12:23.286048+00 |
| updated_at | 2026-01-20 19:09:21.905231+00 |
| description | Auto translate locales build time and runtime |
| homepage | https://github.com/razein97/rust-i18n-autotranslate |
| repository | https://github.com/razein97/rust-i18n-autotranslate |
| max_upload_size | |
| id | 2035668 |
| size | 101,627 |
Auto translate locales build time and runtime.
cache = true to reuse already translated words.use cargo:
cargo add rust-i18n-autotranslate
Add dependencies in your cargo.toml
[dependencies]
rust-i18n-autotranslate = "0.1"
The crate uses env variables to set the api key:
How to generate google api key
Call the translate function directly to translate your locales
use rust_i18n_autotranslate::{
TranslationAPI,
config::{Config, TranslationProvider},
};
fn main() {
env_logger::init();
let cfg = Config::new()
.locales_directory("./locales")
.source_lang("en")
.add_target_lang("fr")
.use_cache(true)
.translation_provider(TranslationProvider::GOOGLE)
.build();
TranslationAPI::translate(cfg).unwrap()
}