#[macro_export]
macro_rules! tr {
($content:expr) => {
r18::translate("", $content)
};
($content:expr, $($arg:expr),+) => {{
use r18::{Format, SimpleCurlyFormat};
SimpleCurlyFormat.format(r18::translate("", $content), &[$($arg),+])
.unwrap_or_default()
}};
([$prefix:expr] $content:expr) => {
r18::translate($prefix, $content)
};
([$prefix:expr] $content:expr, $($arg:expr),+) => {{
use r18::{Format, SimpleCurlyFormat};
SimpleCurlyFormat.format(r18::translate($prefix, $content), &[$($arg),+])
.unwrap_or_default()
}};
}
#[macro_export]
#[allow(clippy::crate_in_macro_def)]
macro_rules! set_locale {
($locale:expr) => {
crate::__r18_gen::set_locale($locale)
};
}
#[macro_export]
macro_rules! locale {
() => {
$crate::CURRENT_LOCALE
.lock()
.unwrap()
.as_ref()
.map(|l| l.name)
};
}
#[macro_export]
macro_rules! auto_detect {
() => {
r18::get_locale().map(|l| r18::set_locale!(l))
};
}