0
ActionMessage message = new ActionMessage("ERRORS_MAX_NUMBER",maxNumber);

When this message is finally rendered as HTML, the maxNumber is shown in format 1,00,000. The maxNumber is an int an there is no ',' character in it. And after that when the text is localized to Portuguese the ',' is replaced by '.' and hence the number is shown as 1.00.000

I don't know what is going on. How to explain this behavior?

Roman C
  • 49,761
  • 33
  • 66
  • 176
harsh
  • 1,471
  • 13
  • 12
  • What is the type of maxNumber, and its value? What is the value of the message stored under the key ERRORS_MAX_NUMBER? Where do you see 1,00,000 displayed? Where do you see 1.00.000 displayed? – JB Nizet Aug 17 '13 at 14:58

1 Answers1

0

This happens because the current locale used to format the message changed after localization. If you want to keep it permanent, you should prefix to a specified locale key for example

ActionMessage message = new ActionMessage(Locale.US.toString()+"."+"ERRORS_MAX_NUMBER", maxNumber);

would format the message to the locale "en_US".

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • The problem was solved when i did `ActionMessage message = new ActionMessage("ERRORS_MAX_NUMBER",String.valueOf(maxNumber));` `maxNumber` here is of type int. Apparently the type of the message is checked when the jsp is served with the localized content and if its a number its formatted by struts/tiles – harsh Aug 18 '13 at 13:22