Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integer gets formatted with commas when it gets fetched from a ResourceBundle

year.of.birth={0} was born on {1}

If I pass 2000 or 2008 to {1} the value gets parsed as 2,000 or 2,008. 

I don't want the commas as part of my translated string. How should I avoid this?

like image 695
user339108 Avatar asked Dec 29 '10 12:12

user339108


1 Answers

The easy way is to pass them as Strings:

msg.format("year.of.birth", name,  String.valueOf(2008));

An alternative is to specify the number format in the message resource (but I would only do that if the format can vary between locales):

year.of.birth={0} was born in {1,number,####}
like image 73
Thilo Avatar answered Sep 22 '22 03:09

Thilo