dwalldorf
dwalldorf

Reputation: 1379

Spring localization truncates decimals

I'm using Spring localization with a properties file and basically want to localize {0}€ with the parameter being a BigDecimal. The localzied output will show 1€ instead of 1.00€ while 1.01€ will be displayed as should be.

Is there a way to leave blank decimal places untouched?

Upvotes: 0

Views: 39

Answers (1)

Vitalii Vitrenko
Vitalii Vitrenko

Reputation: 10395

You can define message format for numbers this way

product.price = Price: {0, number, #.##}€

See Dealing with Compound Messages and MessageFormat

Upvotes: 1

Related Questions