pub struct POEntry {Show 14 fields
pub msgid: String,
pub msgstr: Option<String>,
pub msgid_plural: Option<String>,
pub msgstr_plural: Vec<String>,
pub msgctxt: Option<String>,
pub obsolete: bool,
pub comment: Option<String>,
pub tcomment: Option<String>,
pub occurrences: Vec<(String, String)>,
pub flags: Vec<String>,
pub previous_msgid: Option<String>,
pub previous_msgid_plural: Option<String>,
pub previous_msgctxt: Option<String>,
pub linenum: usize,
}Expand description
PO file entry representing a message
This struct contains all the information that is stored in PO files.
PO entries can contain msgstr or the fields
msgid_plural and msgstr_plural as not being None.
The logic would be:
- If
msgstris notNone, then the entry is a translation of a singular form. - If
msgid_pluralis notNone, then the entry is a translation of a plural form contained inmsgstr_plural.
The previous_msgid and previous_msgid_plural fields
are used to store the previous msgid and msgid_plural
values when the entry is obsolete.
The previous_msgctxt field is used to store the previous
msgctxt value when the entry is obsolete.
Fields§
§msgid: Stringuntranslated string
msgstr: Option<String>translated string
msgid_plural: Option<String>untranslated string for plural form
msgstr_plural: Vec<String>translated strings for plural form
msgctxt: Option<String>context
obsolete: boolthe entry is marked as obsolete
comment: Option<String>generated comments for machines
tcomment: Option<String>generated comments for translators
occurrences: Vec<(String, String)>files and lines from which the translations are taken
flags: Vec<String>flags indicating the state, i.e. fuzzy
previous_msgid: Option<String>previous untranslated string
previous_msgid_plural: Option<String>previous untranslated string for plural form
previous_msgctxt: Option<String>previous context
linenum: usizeline number in the file or content
Implementations§
Source§impl POEntry
impl POEntry
Sourcepub fn new(linenum: usize) -> Self
pub fn new(linenum: usize) -> Self
Creates a new POEntry
It just creates the entry with a given line number.
This function is used by the parser to initialize new
entries. Use the From traits instead to initialize
POEntrys from strings.
Sourcepub fn to_string_with_wrapwidth(&self, wrapwidth: usize) -> String
pub fn to_string_with_wrapwidth(&self, wrapwidth: usize) -> String
Convert to string with a given wrap width
pub fn unescaped(&self) -> Result<Self, EscapingError>
Sourcepub fn cmp_by(&self, other: &Self, options: &EntryCmpByOptions) -> Ordering
pub fn cmp_by(&self, other: &Self, options: &EntryCmpByOptions) -> Ordering
Compare the current entry with other entry
You can disable some comparison options by setting the corresponding
field in options to false. See EntryCmpByOptions.
Trait Implementations§
Source§impl MsgidEotMsgctxt for POEntry
impl MsgidEotMsgctxt for POEntry
Source§fn msgid_eot_msgctxt(&self) -> String
fn msgid_eot_msgctxt(&self) -> String
msgid + (optionally: EOT + msgctxt)