pub struct Catalog { /* private fields */ }Expand description
Texts by language and by key.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn set(
&mut self,
language: &str,
key: impl Into<String>,
text: impl Into<String>,
)
pub fn set( &mut self, language: &str, key: impl Into<String>, text: impl Into<String>, )
Puts this text under this key, in this language, over what was there.
Sourcepub fn with(
self,
language: &str,
key: impl Into<String>,
text: impl Into<String>,
) -> Self
pub fn with( self, language: &str, key: impl Into<String>, text: impl Into<String>, ) -> Self
The same, as a builder.
Sourcepub fn merge_json(
&mut self,
language: &str,
json: &str,
) -> Result<(), TextError>
pub fn merge_json( &mut self, language: &str, json: &str, ) -> Result<(), TextError>
Puts the texts of a flat JSON object of keys, as { "ui.save": "Gravar" }, over what was
there. Nothing is put when something in it is not text.
Sourcepub fn text(&self, language: &str, key: &str) -> Option<&str>
pub fn text(&self, language: &str, key: &str) -> Option<&str>
The text of a key in a language, or in English when the language does not have it.
Sourcepub fn own_text(&self, language: &str, key: &str) -> Option<&str>
pub fn own_text(&self, language: &str, key: &str) -> Option<&str>
The text of a key in a language, and only in it.
Sourcepub fn keys(&self, language: &str) -> impl Iterator<Item = &str>
pub fn keys(&self, language: &str) -> impl Iterator<Item = &str>
The keys it has in a language.
Trait Implementations§
impl Eq for Catalog
impl StructuralPartialEq for Catalog
Auto Trait Implementations§
impl Freeze for Catalog
impl RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnsafeUnpin for Catalog
impl UnwindSafe for Catalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more