use crate::translator::errors::*;
pub const DUMMY_TRANSLATOR_FILE_EXT: &str = "";
#[derive(Clone, Debug)]
pub struct DummyTranslator;
impl DummyTranslator {
pub fn new(_locale: String, _translations_string: String) -> Result<Self, TranslatorError> {
Ok(Self {})
}
pub fn url(&self, _url: &str) -> String {
panic!("attempted to call function on dummy translator, please add the `translator-fluent` feature flag if you want to use i18n")
}
pub fn get_locale(&self) -> String {
"xx-XX".to_string()
}
pub fn translate(&self, _id: &str) -> String {
panic!("attempted to call function on dummy translator, please add the `translator-fluent` feature flag if you want to use i18n")
}
pub fn translate_checked<I: Into<String> + std::fmt::Display>(
&self,
_id: &str,
) -> Result<String, TranslatorError> {
panic!("attempted to call function on dummy translator, please add the `translator-fluent` feature flag if you want to use i18n")
}
}
#[doc(hidden)]
#[derive(Debug)]
pub struct TranslationArgs;
impl TranslationArgs {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
Self {}
}
pub fn set(&self, _key: &str, _val: &str) {}
}
#[doc(hidden)]
pub fn t_macro_backend(_id: &str) -> String {
panic!("attempted to call translator macro, you should enable the `translator-fluent` flag to use i18n")
}
#[doc(hidden)]
pub fn t_macro_backend_with_args(_id: &str, _args: TranslationArgs) -> String {
panic!("attempted to call translator macro, you should enable the `translator-fluent` flag to use i18n")
}
#[doc(hidden)]
pub fn link_macro_backend(_url: &str) -> String {
panic!("attempted to call translator macro, you should enable the `translator-fluent` flag to use i18n")
}