Pretty print compact message format ast
Turns a compact format-message ast:
[ "You have ", [ "numBananas", "plural", 0, {
"=0": [ "no bananas" ],
"one": [ "a banana" ],
"other": [ [ '#' ], " bananas" ]
} ], " for sale." ]
into a pretty ICU Message Format string:
`You have {
numBananas, plural,
=0 {no bananas}
one {a banana}
other {# bananas}
} for sale`
Quick Examples
npm install format-message-print --save
import parse from 'format-message-parse'
import print from 'format-message-print'
print(parse('Hello, {name}!'))
API
print(pattern)
Generate a string from an ast. The output is a canonical version of the pattern.
License
This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.