Crates.io | tiny-i18n |
lib.rs | tiny-i18n |
version | 0.1.6 |
source | src |
created_at | 2024-06-04 17:04:17.980085 |
updated_at | 2024-06-06 19:51:51.213507 |
description | A tiny library to internationalize your project |
homepage | |
repository | https://gitlab.com/crat1985/tiny-i18n |
max_upload_size | |
id | 1261761 |
size | 3,592 |
en-US
)my_i18n_library::i18n!("path_of_the_translations_directory"); //defaults to `i18n` if blank
fn main() {
// Each translation key generates a macro (every non-ASCII letter, number or underscore are removed)
println!("{}", i18n::hello_world!("en-us")); //the first argument is the language, the following are the arguments (optional)
}
The structure is the following :
└── *The name of your i18n folder*
└── en-US
└── *You can put as many JSON files as you want inside each language folder*
└── *Other languages*
The syntax of the JSON translations files is the following :
{
"your_translation_key": "Your translation for the language (= the name of directory the file is in)"
}