use super::*;
pub(crate) const HOOKS_I18N_DEFAULT_LOCALE: &str = "en";
pub(crate) const HOOKS_I18N_OTHER_LOCALE: &str = "zh-CN";
pub(crate) const HOOKS_I18N_LABEL_EN: &str = "English";
pub(crate) const HOOKS_I18N_LABEL_OTHER: &str = "中文";
pub(crate) const HOOKS_I18N_KEY_GREETING: &str = "greeting";
pub(crate) const HOOKS_I18N_KEY_FAREWELL: &str = "farewell";
pub(crate) const HOOKS_I18N_EN_MESSAGES: [(&str, &str); 2] = [
("greeting", "Hello, world!"),
("farewell", "Goodbye, world!"),
];
pub(crate) const HOOKS_I18N_ZH_MESSAGES: [(&str, &str); 2] =
[("greeting", "你好,世界!"), ("farewell", "再见,世界!")];
pub(crate) fn hooks_i18n_switch(handle: I18n, locale: String) -> Option<Rc<dyn Fn(Event)>> {
Some(Rc::new(move |_: Event| {
handle.change_locale(locale.as_str());
}))
}
pub(crate) fn hooks_i18n_translate(handle: I18n, key: &'static str) -> String {
handle.t(key)
}