This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
please explain to me how this flow of this internationalization example is working. The code works Allright but Im not being able to get my brain around it. WEB-INF/classes/resource. The resource directory has 2 Properties file. One is called application.properties and has the code index.title=Welcome within it and the other is called application_de.properties and has the code index.title=Wilkommen. (If your browser is set to English it say welcome else if its German it say Wilkommen)
In struts-config.xml, I added the line: <message-resource parameter="resource.application" />
My question is, how is that this JSP page not knowing anything about the two application files being able to work properly? What does struts-config do to help? Im a complete newbie and this is my first Struts code so please excuse if I asked a silly question. Would like any and all explanations.
To implement i18n in struts app, we need to maintain multiple properties file for each language and those needs to be placed in classpath i.e. WEB-INF/classes/resource for your case. The _de suffix indicates the German locale. We need to configure default resource bundle entry in struts-config.xml file i.e. <message-resources parameter="resource.application"/>. We only need to add the default resource file to struts-config.xml. When we change the locale, the appropriate resource file (application_de.properties) will be looked up automatically.
The Struts tag <html:html locale="true"> reads the "Accept-Language" header sent by the browser, and set up a Locale object in user's session if it is not already there.
Hope this help!
--------- SCJP 1.4 | SCWCD 1.4 | SCBCD 1.3 | SCEA Part I - In Progress