perseus/translator/
dummy.rs1use crate::translator::errors::*;
2
3pub const DUMMY_TRANSLATOR_FILE_EXT: &str = "";
5
6#[derive(Clone, Debug)]
14pub struct DummyTranslator;
15impl DummyTranslator {
16 pub fn new(_locale: String, _translations_string: String) -> Result<Self, TranslatorError> {
19 Ok(Self {})
20 }
21 pub fn url(&self, _url: &str) -> String {
23 panic!("attempted to call function on dummy translator, please add the `translator-fluent` feature flag if you want to use i18n")
24 }
25 pub fn get_locale(&self) -> String {
28 "xx-XX".to_string()
29 }
30 pub fn translate(&self, _id: &str) -> String {
33 panic!("attempted to call function on dummy translator, please add the `translator-fluent` feature flag if you want to use i18n")
34 }
35 pub fn translate_checked<I: Into<String> + std::fmt::Display>(
38 &self,
39 _id: &str,
40 ) -> Result<String, TranslatorError> {
41 panic!("attempted to call function on dummy translator, please add the `translator-fluent` feature flag if you want to use i18n")
42 }
43}
44
45#[doc(hidden)]
48#[derive(Debug)]
49pub struct TranslationArgs;
50impl TranslationArgs {
51 #[allow(clippy::new_without_default)]
53 pub fn new() -> Self {
54 Self {}
55 }
56 pub fn set(&self, _key: &str, _val: &str) {}
60}
61
62#[doc(hidden)]
64pub fn t_macro_backend(_id: &str) -> String {
65 panic!("attempted to call translator macro, you should enable the `translator-fluent` flag to use i18n")
66}
67#[doc(hidden)]
70pub fn t_macro_backend_with_args(_id: &str, _args: TranslationArgs) -> String {
71 panic!("attempted to call translator macro, you should enable the `translator-fluent` flag to use i18n")
72}
73#[doc(hidden)]
75pub fn link_macro_backend(_url: &str) -> String {
76 panic!("attempted to call translator macro, you should enable the `translator-fluent` flag to use i18n")
77}