pub struct MOEntry {
pub msgid: String,
pub msgstr: Option<String>,
pub msgid_plural: Option<String>,
pub msgstr_plural: Vec<String>,
pub msgctxt: Option<String>,
}Expand description
MO file entry representing a message
Unlike PO files, MO files contain only the content needed to translate a program at runtime, so this is struct optimized as saves much more memory than POEntry.
MO entries ieally 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.
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
Implementations§
Trait Implementations§
source§impl MsgidEotMsgctxt for MOEntry
impl MsgidEotMsgctxt for MOEntry
source§fn msgid_eot_msgctxt(&self) -> String
fn msgid_eot_msgctxt(&self) -> String
Returns
msgid + (optionally: EOT + msgctxt)source§impl PartialEq<MOEntry> for MOEntry
impl PartialEq<MOEntry> for MOEntry
source§impl Translated for MOEntry
impl Translated for MOEntry
source§fn translated(&self) -> bool
fn translated(&self) -> bool
Returns true if the entry is translated
Really, MO files has only translated entries, but this function is here to be consistent with the PO implementation and to be used when manipulating MOEntry directly.