Internationalization means preparing your application to support for different language.
For implementing different language we need to do the following:
1) Create a Resource bundle for messages.
2) Manage Locale using Http Header.
3) Retrive bundle messages using UI tags.
Bundle can be created global to application or specific to package or action etc.
For setting global resouce file we need to make an entry in struts.properties file:
struts.custom.i18n.resources=msg
and we will be having resource file with name msg_en.properties for english.
And in this property file we will be having enrty like:
username=Enter User Name
Other than this global resource file we can create action or package specific resource file with name as:
ActionClass.properties,Interface.properties,package.properties etc.
Various ways we with which we can access message properties:
Example:
<s:property value="getText('username')" /> <s:text name="username" /> <s:textfield key="username" name="data"/>
Using i18n tag:
<s:i18n name="some.package.bundle"> <s:text name="username" /> </s:i18n>
For changing the language we need to change the request locale of Http Request and then application will automatically pick the corresponding language resource bundle file.