Function fluent_syntax::serializer::serialize

source ·
pub fn serialize<'s, S: Slice<'s>>(resource: &Resource<S>) -> String
Expand description

Serializes an abstract syntax tree representing a Fluent Translation List into a String.

§Example

use fluent_syntax::parser;
use fluent_syntax::serializer;

let ftl = r#"
unnormalized-message=This message has
  abnormal spacing and indentation"#;

let resource = parser::parse(ftl).expect("Failed to parse an FTL resource.");

let serialized = serializer::serialize(&resource);

let expected = r#"unnormalized-message =
    This message has
    abnormal spacing and indentation
"#;

assert_eq!(expected, serialized);