22 lines
819 B
Markdown
22 lines
819 B
Markdown
# 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
|
|
|
|
```rs
|
|
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](https://developers.deepl.com/docs) key. Only DeepL is supported at the moment.
|
|
|
|
This library is still experimental and in the early stages of development.
|