l0012=the verify code you entered is incorrect
l0012=The verification code you entered is incorrect
3. Open the Chinese properties file for transcoding and use native2ascii for transcoding (1) Open the directory where the validator_zh_CN.properties file is located
cd D:\AndrewProject\XXX\XXX\src\main\resources
(2) Convert the file to ascii format
native2ascii validator_zh_CN.properties validator_zh_CN.properties
Content after conversion
l0012=\u60A8\u8F93\u5165\u7684\u9A8C\u8BC1\u7801\u4E0D\u6B63\u786E
4. Use Util to call the content of properties
public static String getValMsg(String code){ try { ResourceBundle bundleSC = ResourceBundle.getBundle("validator",Locale.TRADITIONAL_CHINESE); String msgSC = bundleSC.getString(code); return msgSC; } catch (Exception e) { return "No corresponding verification information found"; } }
Supplementary instructions (1) Use native2ascii to transcode native2ascii inputFile.txt outputFile.txt (2) Use java to read properties content to read file ResourceBundle bundleSC = ResourceBundle.getBundle("validator",Locale.TRADITIONAL_CHINESE); ① validator corresponds to validator_zh_CN.properties The file name in ② Locale.TRADITIONAL_CHINESE represents Chinese Locale.US represents English read attribute value String value = bundleUS.getString("key");