macro_rules! i18n_string {
($name:ident, $($lang:expr),+) => { ... };
}Expand description
Macro to define an internationalized string constant.
This macro creates a public constant of type I18NString that contains
string variants for all supported languages. The strings are provided
in the same order as the Languages enum variants.
§Syntax
ⓘ
matrix_gui::i18n_string!(NAME, string_for_lang0, string_for_lang1);§Arguments
NAME- The identifier name for the constantstring_for_langN- The string for each language (must match LANG_COUNT)
§Examples
use matrix_gui::prelude::*;
// Define internationalized strings for UI elements
matrix_gui::i18n_string!(TIP_ON, "开", "ON");
matrix_gui::i18n_string!(TIP_OFF, "关", "OFF");
matrix_gui::i18n_string!(MENU_SETTINGS, "设置", "Settings");
// Use the strings
println!("{}", TIP_ON.as_str());§Notes
- The number of string arguments must match the number of supported languages
- The order of strings must correspond to the
Languagesenum variants - The generated constant is public and can be used across modules