endolingual/README.md
2024-12-04 19:44:20 +02:00

819 B

Endolingual

Procedural macros in Rust can execute arbitrary code at compile time, even performing network requests. This has potentially terrifying security implications, but we'll use it to our advantage!

Endolingual is a Rust macro which translates strings of natural language text into multiple foreign languages at once by making API requests at compile time. The produced translations are &'static str values, so they are very lightweight.

Examples

use endolingual::{translate, TranslationSet};

let button_text_french: &str = translate!("Sign up").fr;
// ...

Usage

Set the environment variable DEEPL_API_KEY to your DeepL API key. Only DeepL is supported at the moment.

This library is still experimental and in the early stages of development.