当前位置: 首页 > 工具软件 > Apache Wicket > 使用案例 >

Apache Wicket参考手册:Internationalization with Wicket 多语言国际化问题的解决

黄君博
2023-12-01

https://ci.apache.org/projects/wicket/guide/6.x/guide/i18n.html

Using UTF-8 for resource bundles

Java uses the standard character set ISO 8859-11 to encode text files like properties files. Unfortunately ISO 8859-1 does not support most of the extra-European languages like Chinese or Japanese. The only way to use properties files with such languages is to use escaped Unicode characters, but this leads to not human-readable files. For example if we wanted to write the word 'website' in simplified Chinese (the ideograms are 网站) we should write the Unicode characters \u7F51\u7AD9. For this reason ISO 8859-11 is being replaced with another Unicode-compliant character encoding called UTF-8. Text files created with this encoding can contain Unicode symbols in plain format. Wicket provides a useful convention to use properties file encoded with UTF-8. We just have to add prefix .utf8. to file extension (i.e. .utf8.properties).

If you want to use UTF-8 with your text files, make sure that your editor/IDE is actually using this character encoding. Some OS like Windows use a different encoding by default.

 类似资料: