pub struct Strings { /* private fields */ }Expand description
The catalogue a host installs, and the one components read.
It holds only the entries a host replaced. An absent entry is not a gap to be filled at runtime; it means the English default stands, which is why a partial catalogue is a legitimate thing to install rather than a mistake.
Implementations§
Source§impl Strings
impl Strings
Sourcepub fn set(
&mut self,
key: StringKey,
text: impl Into<SharedString>,
) -> &mut Self
pub fn set( &mut self, key: StringKey, text: impl Into<SharedString>, ) -> &mut Self
Replaces one entry.
Sourcepub fn extend(
&mut self,
entries: impl IntoIterator<Item = (StringKey, SharedString)>,
) -> &mut Self
pub fn extend( &mut self, entries: impl IntoIterator<Item = (StringKey, SharedString)>, ) -> &mut Self
Replaces many entries, leaving the rest alone.
Sourcepub fn is_overridden(&self, key: StringKey) -> bool
pub fn is_overridden(&self, key: StringKey) -> bool
Whether this key was replaced. A component never asks; a test does.
Sourcepub fn text(&self, key: StringKey) -> SharedString
pub fn text(&self, key: StringKey) -> SharedString
The text behind a key, which is always something a reader can read.
Sourcepub fn format(&self, key: StringKey, args: &[&str]) -> SharedString
pub fn format(&self, key: StringKey, args: &[&str]) -> SharedString
The text behind a key with {0}, {1}, … replaced in place.
A placeholder with no argument is left standing rather than removed, so a wrong translation reads as an obvious mistake instead of a sentence that quietly lost a fact.
Trait Implementations§
impl Global for Strings
Auto Trait Implementations§
impl Freeze for Strings
impl RefUnwindSafe for Strings
impl Send for Strings
impl Sync for Strings
impl Unpin for Strings
impl UnsafeUnpin for Strings
impl UnwindSafe for Strings
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ReadGlobal for Twhere
T: Global,
impl<T> ReadGlobal for Twhere
T: Global,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().Source§impl<T> UpdateGlobal for Twhere
T: Global,
impl<T> UpdateGlobal for Twhere
T: Global,
Source§fn update_global<C, F, R>(cx: &mut C, update: F) -> R
fn update_global<C, F, R>(cx: &mut C, update: F) -> R
Updates the global instance of the implementing type using the provided closure. Read more
Source§fn set_global<C>(cx: &mut C, global: T)where
C: BorrowAppContext,
fn set_global<C>(cx: &mut C, global: T)where
C: BorrowAppContext,
Set the global instance of the implementing type.