Contents
use utopia_locale::Languages;Rust
pub struct Languages {
// private fields
}Every registered language, and whether missing languages and keys are errors.
PHP: the static state of Locale.
Also implements
PartialEq, Default.use utopia_locale::Locale;Rust
pub struct Locale<'a> {
// private fields
}A view of Languages with a default and an optional fallback language.
use utopia_locale::Error;Rust
pub enum Error {
Exception(String),
Type(String),
Unsupported(String),
}Why a lookup or a language registration failed.
PHP: each variant matches the exception class PHP throws, given by
Error::php_class.
use utopia_locale::Missing;Rust
pub enum Missing<'a> {
Key,
Text(&'a str),
Null,
}What Locale::text returns for a key no language has.
PHP: the $default argument of getText().
Rust
pub type Translations = IndexMap<String, String, RandomState>;Translations of one language, in file order.
Rust
pub const DEFAULT_DYNAMIC_KEY: &str = "[[defaultDynamicKey]]";A marker text that, passed as Missing::Text, means Missing::Key.
PHP: Locale::DEFAULT_DYNAMIC_KEY.