{msg} tags not allowed in <script type=text/template> ?
robfig opened this issue · comments
I wanted to ask why {msg} tags are no longer allowed in blocks of type <script type="text/template">
. These blocks are useful for non-Soy client-side templates and it seems unobjectionable to have localized messages in them.
For example,
{template .clientSideTemplate}
<script type="text/template">
{msg desc=""}Hello world{/msg}
</script>
{/template}
results in an error like
error: Invalid or ambiguous syntax prevents Soy from escaping this template correctly:
- Messages are not supported in this context, because it would mean asking translators to write source code; if this is desired, try factoring the message into a {let} block: (Context HTML_SCRIPT_PHRASING_DATA)
Extracting all messages into {let} blocks is fairly cumbersome as a workaround, being additional ceremony and making it harder to read the template, for no apparent benefit.
Thanks for the consideration
Here's a patch that treats these blocks as HTML.
yext@5a494e3
That solves this problem as well as some others that arise in their usage.