[−][src]Struct appstream::TranslatableList
A wrapper around a list of strings that are translatable.
It's mostly used for the list of keywords a component can have
Example
use appstream::TranslatableList; let keywords = TranslatableList::with_default(vec!["Color", "Contrast", "GNOME", "GTK"]) .and_locale("cs", vec!["barva", "kontrast"]) .and_locale("da", vec!["Farve", "Kontrast"]);
Implementations
impl TranslatableList
[src]
pub fn with_default(words: Vec<&str>) -> Self
[src]
Create a new TranslatableList
using the default locale.
Arguments
words
- List of strings to add to the default locale.
pub fn and_locale(self, locale: &str, words: Vec<&str>) -> Self
[src]
Adds a list of strings for a specific locale.
Very useful when constructing a TranslatableList
manually.
Arguments
locale
- The locale to use, usewith_default
if you want the default locale.words
- The list of strings to add to this specific locale.
pub fn add_for_element(&mut self, element: &Element)
[src]
Adds a new string from a xmltree.Element
XML elements containing a lang
attribute are marked as translatable
and can be used to feed the TranslatableList
.
pub fn add_for_locale(&mut self, locale: Option<&str>, text: &str)
[src]
Adds a new string for a specific locale.
Arguments
locale
- The locale to use,C
is used ifNone
is provided.text
- The string to add.
pub fn is_empty(&self) -> bool
[src]
Whether self
contains any translatable strings.
Trait Implementations
impl Clone for TranslatableList
[src]
fn clone(&self) -> TranslatableList
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for TranslatableList
[src]
impl Default for TranslatableList
[src]
fn default() -> TranslatableList
[src]
impl<'de> Deserialize<'de> for TranslatableList
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<TranslatableList> for TranslatableList
[src]
fn eq(&self, other: &TranslatableList) -> bool
[src]
fn ne(&self, other: &TranslatableList) -> bool
[src]
impl Serialize for TranslatableList
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for TranslatableList
[src]
Auto Trait Implementations
impl RefUnwindSafe for TranslatableList
impl Send for TranslatableList
impl Sync for TranslatableList
impl Unpin for TranslatableList
impl UnwindSafe for TranslatableList
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,