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=25971>. 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=25971 Cannot retrieve all MessageResources messages Summary: Cannot retrieve all MessageResources messages Product: Struts Version: 1.1 Final Platform: PC OS/Version: Windows XP Status: NEW Severity: Enhancement Priority: Other Component: Unknown AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] I'm developing an app that is localized into various European languages. I've used Struts' support for multiple resource bundles by creating topical bundles, such as one of country names keyed by their ISO-3166 codes, and so forth, as well as a default bundle of general messages. I intend to use these topical resource bundles to populate localized form drop-downs, but MessageResources doesn't have any public methods nor fields to access all messages without first knowing their keys. To solve this, I suggest a pair of methods like... public java.lang.String[] getMessages(); public java.lang.String[] getMessages(java.util.Locale locale); ...to access all of the messages in a bundle. Since I would also need to know the messages' keys, I further suggest another method like... public java.lang.String[] getKeys(); ...which would also allow the use of parametric replacement when traversing a bundle by passing each key into an existing getMessage() method. The benefit of returning String arrays is that they are immutable, protecting the underlying resource bundle from corruption. Alternately, an Iterator implementation that ignores remove() could be returned, since remove() is optional. Because PropertyMessageResouces (MessageResources' concrete subclass) is backed by a Map, neither approach should be very difficult. Finally, and this is probably beyond the scope of this suggestion, I need the messages (not the keys) to be in alphabetical order, which would be quite difficult using my suggested enhancement. So, I'll probably have to subclass PropertyMessageResources after all, but I thought I'd suggest this as an enhancement anyhow, since others would obviously benefit from the functionality. Of course, I could manually sort the actual message bundle contents, but that isn't nearly as elegant and is prone to error. JayZ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
