Kapur-san wrote:
> I have attached the changed classes and the jsp files along with the source.
> Heres how to use it. Replace the logon.jsp in struts-example subdir with the
> file in my distribution. Also replace the class files LogonAction.class and
> LogonForm.class
Very nice. In order to add a language, I only had to edit two files:
1. create
WEB-INF/classes/org/apache/struts/example/ApplicationResources_ja.properties
2. edit the following lines in login.jsp:
pageContext.setAttribute("languageValues",
new String[] { "en_US", "de_DE", "ja_JP" });
pageContext.setAttribute("languageLabels",
new String[] { "English", "German", "Japanese" });
and it was done. This is the major feature that the other sample lacked.
There was just one major problem. On my environment, the English wouldn't
show up, even when selected. I have Japanese as my default environment, so
when ResourceBundle is unable to file ApplicationResources_en.properties, it
tries the default locale next, which is ApplicationResources_ja.properties.
It is only if the keys can't be found in the default locale also that
ResourceBundle looks in ApplicationResources.properties. Most people with
English as their default locale don't seem to realize that the _en.properties
file does have a meaning.
To fix this, I "ln -s"ed the _en props to the "default" properties file, and
all worked well.
Very nice example.
--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home: http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/