We are using velocity as template. We use NumberTool to format number in vm files.
For example
$!{NUMBER.format('#,##0',$!{amount})} 円
Expected output is for example 9,900円 . It works in almost 99.9999% of the cases. But sometimes for example once in a few months it displays as 9.900円 in our web page.
Does anyone face same problem ? Is there any bug in NumberTool related to Locale or some other issue?
The decimals separator can depend on the locale.
To avoid this, you can configure a specific locale to the number tool. For instance, when using a tools.xml
file:
<tool key="number" class="org.apache.velocity.tools.generic.NumberTool" locale="en_US"/>
Or you can specify the Locale using Java:
numberTool.setLocale("en_US")