Init commit

This commit is contained in:
Markus Scully 2024-11-14 20:56:28 +00:00
commit 3a9f283e99
No known key found for this signature in database
GPG key ID: B8470B38660AF9E8
13 changed files with 418 additions and 0 deletions

25
README.md Normal file
View file

@ -0,0 +1,25 @@
# Autolingual
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!
Autolingual is a Rust macro which automatically translates strings of natural language text into multiple foreign languages at once at compile time. The produced translations are `&'static str` values, so they are very lightweight.
## Examples
```rs
use autolingual::{translate, TranslationSet};
// No context
let button_text_french: &str = translate!("Sign up").fr;
// With context (context will not show up in the final translation)
let button_text_french: &str = translate!("Sign up", "A button for creating a user account.").fr;
// Every supported language at once.
let translation_set: TranslationSet = translate!("Hello!");
let french = translation_set.fr;
let german = translation_set.de;
let portuguese = translation_set.pt;
// ...
```