diff options
Diffstat (limited to 'third_party/rust/fluent-bundle/src/message.rs')
-rw-r--r-- | third_party/rust/fluent-bundle/src/message.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/third_party/rust/fluent-bundle/src/message.rs b/third_party/rust/fluent-bundle/src/message.rs new file mode 100644 index 0000000000..4b0a84769e --- /dev/null +++ b/third_party/rust/fluent-bundle/src/message.rs @@ -0,0 +1,20 @@ +use fluent_syntax::ast; + +#[derive(Debug, PartialEq)] +pub struct FluentAttribute<'m> { + pub id: &'m str, + pub value: &'m ast::Pattern<&'m str>, +} +/// A single localization unit composed of an identifier, +/// value, and attributes. +#[derive(Debug, PartialEq)] +pub struct FluentMessage<'m> { + pub value: Option<&'m ast::Pattern<&'m str>>, + pub attributes: Vec<FluentAttribute<'m>>, +} + +impl<'m> FluentMessage<'m> { + pub fn get_attribute(&self, key: &str) -> Option<&FluentAttribute> { + self.attributes.iter().find(|attr| attr.id == key) + } +} |