Hi,
We need to display currencies that are locale sensitive in Sightly. Using JSP and JSTL this is fairly easy :
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <c:set var="balance" value="120000.2309" /> <fmt:formatNumber value="${balance}" type="currency"/>
And we would get something like £120,000.23.
How do we do the same in sightly ? We really don't want our models to do the formatting, as this is really a view level concern.
Thanks
Solved! Go to Solution.
for this you can use the use-api (data-sly-use) and create a Javascript/Java object for this, and this is then reusable for your components.
<div data-sly-use.format="{ 'yourpackage.YourFormatClass' @ value = value, format = format}">
${format.formattedValue}
</div>
for this you can use the use-api (data-sly-use) and create a Javascript/Java object for this, and this is then reusable for your components.
<div data-sly-use.format="{ 'yourpackage.YourFormatClass' @ value = value, format = format}">
${format.formattedValue}
</div>