Java國際化小小示例

pengfoo發表於2012-08-17
test.java
package fp;


import java.util.Locale;
import java.util.ResourceBundle;

public class Test
{
	public static void main(String[] args)
	{
//		Locale mylocale = Locale.getDefault();
		Locale mylocale = new Locale("en","US");
		ResourceBundle bundle = ResourceBundle.getBundle("fp/mess", mylocale);//fp is the package name
		System.out.println(bundle.getString("hello"));
		
		
	}
	
}


mess_en_US.properties

#comment
hello = Welcome you!


mess_zh_CN.properties

#\u8FD9\u662F\u6CE8\u91CA
hello = \u4F60\u597D\uFF01


 

相關文章