#[allow(unused_imports)]
use super::*;
#[derive(PartialEq, Debug, Clone, Default, strum::AsRefStr, strum::EnumIter)]
#[cfg_attr(feature = "mongo", derive(Serialize, Deserialize))]
pub enum Locale {
#[default]
EN,
VI,
ZH,
FR,
}
impl From<&str> for Locale {
fn from(locale: &str) -> Self {
match locale {
"EN" => Self::EN,
"VI" => Self::VI,
"ZH" => Self::ZH,
"FR" => Self::FR,
_ => Self::default(),
}
}
}
#[cfg(feature = "gui")]
pub fn locale_options_ui(ui: &mut egui::Ui, locale: &mut Locale) {
if let Ok(settings) = ClientCfgCel::settings() {
ui.horizontal(|ui| {
ui.label("Language:");
for l in Locale::iter() {
if settings.locales().contains(&l.as_ref().to_string()) {
ui.radio_value(locale, l.clone(), l.as_ref());
};
}
});
};
}
#[cfg(feature = "easy_mark")]
pub const EASYMARK_SYNTAX_HELP: &str = "
EasyMark Syntax:
# header
*bold*
_underline_
/italics/
~strikethrough~
^raised^
$small$
--- horizontal line
`code`
- bullet list
1. numbered list
> quote
[hyperlink](https://hunter.rusty)
";
#[cfg(all(feature = "easy_mark", feature = "gui"))]
pub fn easy_mark_syntax_help(ui: &mut egui::Ui) {
ui.monospace("🔰 Help").on_hover_text(EASYMARK_SYNTAX_HELP);
}