Struct LanguagePack
pub struct LanguagePack {
pub id: &'static str,
pub locales: &'static [&'static str],
pub source_dir: &'static str,
}Expand description
Where a catalogue’s other languages come from: the language packs.
An app’s package carries only its source catalogue, the fallback every
message resolves to. Each other language is a shared language pack,
installed for the languages the person uses and the same bytes for
everyone: <root>/<locale>/<id>.ftl for every catalogue that has that
language, one directory per locale. The roots are language_pack_roots,
which the sandbox lets every app read, and, for a build run from its
source tree (a developer’s, a test’s, a screenshot’s), the crate’s own
locales/ directory.
Fields§
§id: &'static strThe catalogue’s name in a pack: its crate’s package name.
locales: &'static [&'static str]Every locale the catalogue is translated into, its source among them.
source_dir: &'static strThe crate’s locales/ directory where it was built, read when it
exists (<dir>/<locale>.ftl).
Implementations§
§impl LanguagePack
impl LanguagePack
pub fn read(&self, locale: &str) -> Option<String>
pub fn read(&self, locale: &str) -> Option<String>
The Fluent source of locale’s catalogue, from the first root that
has it.
pub fn has(&self, locale: &str) -> bool
pub fn has(&self, locale: &str) -> bool
Whether locale’s catalogue is installed: in a pack, or beside the
crate where it was built.
pub fn installed_locales(&self) -> Vec<&'static str>
pub fn installed_locales(&self) -> Vec<&'static str>
Every locale this catalogue has installed: the ones it was built with and every pack installed since that carries it (a language the registry offers later reads as any other).
Trait Implementations§
§impl Clone for LanguagePack
impl Clone for LanguagePack
§fn clone(&self) -> LanguagePack
fn clone(&self) -> LanguagePack
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for LanguagePack
impl Debug for LanguagePack
impl Copy for LanguagePack
Auto Trait Implementations§
impl Freeze for LanguagePack
impl RefUnwindSafe for LanguagePack
impl Send for LanguagePack
impl Sync for LanguagePack
impl Unpin for LanguagePack
impl UnsafeUnpin for LanguagePack
impl UnwindSafe for LanguagePack
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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 more