I18n International Problem

Source: Internet
Author: User
Tags i18n

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"/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.