We've launched a new support center at help.smartling.com. This site will continue to be maintained into January 2017. Please update your bookmarks.
Follow

Best Practices for Mustache Templates

The following article applies to Global Delivery Network project types. 

Smartling requires HTML to be properly balanced (well-formed). If HTML is not properly balanced, it may render fine or Smartling may attempt to balance the HTML by, for example, introducing additional closing tags.

Balanced HTML Example

<b><i>Text</i></b>

Unbalanced HTML Example

<b><i>Text</b></i>

Smartling may attempt to close the <i> before the <b> resulting in an extra </i> tag.

<b><i>Text</i>

Smartling may attempt to close </b>

Mustache is a web template system that may add additional complexity because of the potential use of conditional logic inside the template.

Incorrect Usage Example

<%if isSomething %> <span>Some text about true <%else>
 <span>Some text about false<%endif> </span>

Smartling will produce the following string:

{0} <span>Some text about true {1} <span>Some text about false {2} </span>

Smartling converts the code snippets inside <% %> into Smartling placeholders since they may contain output such as "<% i %> friends" that must be translated as a single sentence.

Correct Usage Example

<span><%if isSomething%> Some text about true <%else> Some text about false<%endif> </span>

Smartling will produce the following well-balanced HTML string:

<span>{0} Some text about true {1} Some text about false {2} </span>

See also:

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
Powered by Zendesk