DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20468>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20468 MessageResources always uses the default Locale for MessageFormats Summary: MessageResources always uses the default Locale for MessageFormats Product: Struts Version: Nightly Build Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Utilities AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Problem: The following code fragment in an Action Locale myLocale = getLocale(myHttpServletRequest); MessageResources myResources = getResources(); Date myDate = new Date(); String myString = myResources.getMessage(myLocale, "format.date", myDate); should result in a String of the form "04.06.2003" or "04 Jun 2003" depending on the Locale (german or english) when format.date={0,date,medium} but the default Locale is used in both cases. The reason for this is the codeline: format = new MessageFormat(escape(formatString)); in the method: public String getMessage(Locale locale, String key, Object args[]) No Locale is provided in the constructor, therefore the default Locale is used. Solution: Replace the above codeline by: MessageFormat myMessageFormat = new MessageFormat(""); myMessageFormat.setLocale(myLocale); myMessageFormat.applyPattern(escape(myStringFormat)); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]