macro_rules! locales {
($($code:literal),+ $(,)?) => { ... };
}Expand description
Declares the app’s locales as a Locales static, compiling locales/<code>.yml into the binary.
ocre::locales!("en", "fr") includes locales/en.yml and
locales/fr.yml (paths from the app root, CARGO_MANIFEST_DIR) with
include_str! and hands them to Catalog::load
on first use. The first code is the default locale, used for fallbacks. A
missing file is a compile error; a file that does not parse is logged and
listed in Catalog::errors (ocre dev and
ocre deploy refuse it earlier).
§Examples
ⓘ
// Not compiled here: needs `locales/en.yml` and `locales/fr.yml` next to the app's Cargo.toml.
static LOCALES: ocre::i18n::Locales = ocre::locales!("en", "fr");