Javascript Variables

There are a number of ways you could identify data elements on the page.

Data Tokens

Sometimes it is necessary to identify variables within strings on your site. You can use the <var>

Dear <var user>Michael</var>,  

We will automatically convert this to a TML string: "Dear {user},"

Some languages rely on the gender of the viewing user and if you happen to know the gender, you can pass it in the variable:

Dear <var user gender="male">Michael</var>,  

Numeric Tokens & Pluralization

You can tell the SDK to convert all numbers to numeric tokens. That way, even if you change the numeric values on your site, the translations will still remain accurate. Alternatively, you can manually wrap the numbers with <var> tag.

You have <var count>5</var> messages