Java's ResourceBundle.

xiaoxiao2021-03-06  86

Java's ResourceBundle is a very good tool that can be easily used to implement the internationalization and localization of the software. Because ResourceBundle can automatically look for a resource file (.properties file) that meets a culture and region in accordance with certain rules. By providing different resource files for different cultures and regions, then let Java automatically read these resource files according to rules, the localization of software is actually completed. First look at a small example, build a TEST project, the directory structure is as follows: test / classmain.java message_zh.properties message_en.properties 2 message * .properties only one line, name: message_zh.properties: msg0 = "chinese locale" Message_en.properties: msg0 = "english local" classmain.java is equally simple, the main program is only 2 lines: import java.util. *;

转载请注明原文地址:https://www.9cbs.com/read-96188.html

New Post(0)