Java Internationalization
1. Understand that the default Locale is determined by the operating system, and Locale is composed of the language and country code.
2. The international resource file is composed of baseName + locale, for example, MessageBundle_en_US.properties.
BaseName is a legal file name.
3. native2ascii command location and usage
* Location: JAVA_HOME/bin
* Use native2ascii.exe o. properties MessagesBundle_zh_CN.properties
Struts Internationalization
1. struts international configuration
* Add: <message-resources parameter = "MessageResources"/> to the struts-config.xml File
2. Provide international resource files of different versions. Convert Chinese to unicode using native2ascii.
3. Use the <bean: message> label in jsp to read international message text.
4. Understand the features of putting locale into the session by struts by default, and complete the language switching through programming.
* See ChangeLanguageAction. java.
5. There are three steps for international message text processing:
* Create an international message
* Deliver international messages
* Display international messages
How to create international messages?
Understand the differences between ActionMessage and ActionMessages
How do I transmit international messages?
* Call saveMessage () to pass common messages, and call saveErrors to pass error messages.
How to display international messages?
Use the Use
JSTL Internationalization
Introduction: <% @ taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %>
Settings: <fmt: setLocale value = "$ {header ['Accept-color']}"/>
<Fmt: setBundle basename = "res. MessageResources"/>
Valid value: <fmt: message key = "user. username"/>