pub struct Translator<'a> { /* private fields */ }Expand description
Messages in one language.
Implementations§
Source§impl Translator<'_>
impl Translator<'_>
Sourcepub fn t(&self, key: &str) -> String
pub fn t(&self, key: &str) -> String
The message for key; the key itself when no catalog has it.
Sourcepub fn t_with(&self, key: &str, args: &[(&str, &str)]) -> String
pub fn t_with(&self, key: &str, args: &[(&str, &str)]) -> String
The message for key with {name} placeholders filled from args
({{ and }} are literal braces; unknown names stay as written).
Sourcepub fn plural(&self, key: &str, count: u64) -> String
pub fn plural(&self, key: &str, count: u64) -> String
key.<category> for count in this language (one, few, many,
other; see plural_category), falling back to key.other, with
{count} and args filled in.
Sourcepub fn plural_with(
&self,
key: &str,
count: u64,
args: &[(&str, &str)],
) -> String
pub fn plural_with( &self, key: &str, count: u64, args: &[(&str, &str)], ) -> String
Translator::plural with more placeholders.
Trait Implementations§
Source§impl<'a> Clone for Translator<'a>
impl<'a> Clone for Translator<'a>
Auto Trait Implementations§
impl<'a> Freeze for Translator<'a>
impl<'a> RefUnwindSafe for Translator<'a>
impl<'a> Send for Translator<'a>
impl<'a> Sync for Translator<'a>
impl<'a> Unpin for Translator<'a>
impl<'a> UnsafeUnpin for Translator<'a>
impl<'a> UnwindSafe for Translator<'a>
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> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more