0

I am trying to display the Indian currency format using SpringBoot + Thymeleaf. I have used the following code in HTML to display it

<td th:text="${#numbers.formatCurrency(revenueDetailsDto.getTotalCommissionablePremium())}"></td>

  @Bean
    public LocaleResolver localeResolver() {
        SessionLocaleResolver slr = new SessionLocaleResolver();
        slr.setDefaultLocale(new Locale("en", "IN"));
        return slr;
    }

This is showing strings as- Rs.1,599,176.00 .

However, I want results in Indian Numeric format like- Rs. 15,99,176.00 .

Any idea on how to achieve it?

Yogesh Prajapati
  • 4,770
  • 2
  • 36
  • 77
Dhruv Saksena
  • 209
  • 2
  • 13
  • This seems to be a bug. What if you do a test and print the currency with Plain Java like described here: http://tutorials.jenkov.com/java-internationalization/numberformat.html – Simon Martinelli Apr 25 '20 at 08:40
  • I tried with the below code, but the same issue NumberFormat numberFormat = NumberFormat.getInstance(new Locale("en", "in")); System.out.println(numberFormat.format(73746842.00)); – Dhruv Saksena Apr 25 '20 at 14:04

1 Answers1

0

It seems that Java NumberFomat does not support this India currency format.

See: Displaying Currency in Indian Numbering Format

You will need to format the on the server side already.

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82