Crates.io | tiny-i18n |
lib.rs | tiny-i18n |
version | 0.1.12 |
source | src |
created_at | 2024-06-04 17:04:17.980085 |
updated_at | 2024-08-10 13:10:51.842298 |
description | A tiny library to internationalize your project |
homepage | |
repository | https://gitlab.com/crat1985/tiny-i18n |
max_upload_size | |
id | 1261761 |
size | 3,853 |
$argument_name
)en-US
)///This macro generates a function per translation key inside the specified struct.
#[tiny_i18n::i18n("path_of_the_translations_directory")] //defaults to `i18n` if called without argument
pub(crate) struct I18n;
fn main() {
// Each translation key generates a function (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, if any
}
The structure is the following :
└── *The name of your i18n folder*
└── en-US
└── *You can put as many files as you want (with any/no extension) inside each language folder (or inside any subfolder (as many subfolders as you want)), the name of the file (without the extension) is the id of the translation*
└── *Other languages*