# `Cldr.Message.Sigil`
[🔗](https://github.com/elixir-cldr/cldr_messages/blob/v2.0.0/lib/cldr/messages/sigil.ex#L1)

Implements sigil `~M` to canonicalize an
ICU message.

ICU messages allow for whitespace to be used to
format the message for developer and translator readability.
At the same time, `gettext` uses the message string
as a key when resolving translations.

Therefore a developer or translator that modifies
the message for readability may unintentionally
create a new message rather than replace the old one
simply because the message strings don't match exactly.

It is possible to use the `fuzzy` option to the task
`mix gettext.extract` however this may not be the desired
behaviour either.

The sigil `~M` therefore introduces a way for the developer
to ensure the message is in a canonical format during
compilation and therefore both error check the message format
and ensure the message is in a canonical form irrespective
of developer formatting.

# `sigil_M`
*macro* 

Handles the sigil `~M` for ICU message strings.

It returns a a canonically formatted string without
interpolations and without escape characters, except
for the escaping of the closing sigil character
itself.

A canonically formatted string is pretty-printed by
default returning a potentially multi-line
string.  This is intended to produce a result which is
easier to comprehend for translators.

The modifier `u` can be applied to return
a non-pretty-printed string.

## Modifiers

* `p` (default) - pretty-print the message with indentation
* `u` - return a non-pretty-printed (compact) string

## Examples

    iex> ~M(An ICU message)
    "An ICU message"

However, if you want to re-use the sigil character itself on
the string, you need to escape it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
