Laurie, I am using Struts 2.0.8.
This is a large app, and only one module knows anything about the Web Layer. So I'm trying to introduce a 'MessageProviderService' for the non-Struts modules. I wrote a class that wraps the ResourceBundle class, so that I do not have any Struts artifacts in the other layers. I want one of these modules to create a List of all the available ResourceBundle languages. I was hoping to pass in the address of the ResourceBundles, which is stored in the 'struts.properties' file under the key "struts.custom.i18n.resources". Presumably this property is available to the Struts module, where I want to read it and pass it on to the 'MessageProviderService' class, which I want to have parse the ResourceBundle names to get the 'language' suffix, which I then want to convert to the 'language', for example 'zh = chinese'. So I have 2 problems: (1) getting the property 'struts.custom.i18n.resources', and (2) converting the suffix to the language (or I may be able to iterate thru a set of File Names with 'ResourceBundle.getResourceBundle(fileName).getLocale().getLanguage()', or something like that). I hope that is clear. Any advice, especially on point #1 would be great. - Ray Clough > ----- Original Message ----- > From: "Laurie Harper" <[EMAIL PROTECTED]> > To: user@struts.apache.org > Subject: Re: S2 - How do I ... > Date: Tue, 26 Jun 2007 17:01:35 -0400 > > > Ray Clough wrote: > > How do I get the Struts properties from within my application. What I am > > Depends which version of Struts you're using. > > > looking for is to read the property "struts.custom.i18n.resources", which is > > defined in the 'struts.properties' file, so that I can get the > > ResourceBundle names. I guess that there is a Struts Properties object > > which can be referenced and read, the question is how. > > For Struts 1, use the Action.getResources() methods to get the > resource bundle, then retrieve the specific property you want from > that. > > For Struts 2, use the ActionSupport.getText() methods to retrieve > the property directly. > > > Also, although this is not a Struts question, how do I resolve the suffix on > > a ResourceBundle to the language name? > > I'm not sure what you mean. Usually, you take a resource bundle > name and a locale to locate the most locale-specific resource > bundle. Are you trying to derive a locale from a resource bundle > file name? > > L. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - Ray Clough [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]