pub enum I18nError {
LocaleUnavailable(String),
FormatError(String),
Unavailable(String),
Unknown(String),
}Expand description
Why a translate call failed. Ok(rendered) is the overwhelming
majority path — every method here is reserved for a real backend
failure the caller needs to decide about.
Variants§
The requested locale was promised by supported_locales() but
could not be loaded: a missing file, a parse error, a
corrupted bundle. Callers SHOULD retry with the fallback
locale or surface a generic English string.
FormatError(String)
A bundle loaded fine but formatting the specific key failed: an ICU MessageFormat placeholder that did not match the variable bag, a Fluent function call error, a type mismatch between a variable and the pattern that consumed it.
The backend is in a state where it cannot serve any translations right now — an async reload is in flight, a file watcher caught a broken state, a cache eviction storm. Transient; callers MAY retry.
Unknown(String)
The backend hit something it could not classify. Treat as
Unavailable unless you know better.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for I18nError
impl<'de> Deserialize<'de> for I18nError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Error for I18nError
impl Error for I18nError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()