From fbf22ad549c40a4c0feb871a2a1dd74f5c5ad6f2 Mon Sep 17 00:00:00 2001 From: "Sam A. Horvath-Hunt" Date: Mon, 24 Oct 2022 12:16:29 +0100 Subject: [PATCH] Add formatting to README --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index fdf6867..f5ee2a6 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,27 @@ welcome: Redundant select: name ``` +### Formatting + +Pretty-print an ICU message. Useful for inspecting larger messages, such as flattened ones. + +```console +$ cat translations.json +{"tagline": {"message":"{hasTags, boolean, true {{type, select, overLimit {{upperLimit, number}+ best free {formattedListOfTags} photos on Unsplash} belowLimit {{photoTotal, number} best free {formattedListOfTags} photos on Unsplash}}} false {{type, select, overLimit {{upperLimit, number}+ best free photos on Unsplash} belowLimit {{photoTotal, number} best free photos on Unsplash}}}}"}} +$ intlc prettify $(cat translations.json | jq -r .tagline.message) +{hasTags, boolean, + true {{type, select, + overLimit {{upperLimit, number}+ best free {formattedListOfTags} photos on Unsplash} + belowLimit {{photoTotal, number} best free {formattedListOfTags} photos on Unsplash} + }} + false {{type, select, + overLimit {{upperLimit, number}+ best free photos on Unsplash} + belowLimit {{photoTotal, number} best free photos on Unsplash} + }} +} + +``` + ## Schema Translation files should be encoded as JSON and might look something like this: