国际化开发类的实例
来源:互联网 发布:什么是网络剧 编辑:程序博客网 时间:2024/06/01 08:02
1、
public static void main(String[] args) {
// TODO Auto-generated method stub
Locale locale=new Locale("en");
//ResourceBundle bundle=ResourceBundle.getBundle("com.hbsi.resource.MyResource");
ResourceBundle bundle=ResourceBundle.getBundle("com.hbsi.resource.MyResource",locale);
String username=bundle.getString("username");
String password=bundle.getString("password");
String submit=bundle.getString("submit");
System.out.println(username+":"+password+":"+submit);
}
2、时间转化
public static void main(String[] args) throws ParseException{
Date d=new Date();
DateFormat df=DateFormat.getDateInstance(DateFormat.FULL,Locale.CHINA);//获取时间格式器
String result=df.format(d);
System.out.println(result);
String str="2011年11月4日 星期一";
Date d1=df.parse(str);
System.out.println(d1);
df=DateFormat.getDateInstance(DateFormat.FULL,Locale.ENGLISH);//获取时间格式器
result=df.format(d);
System.out.println(result);
df=DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.LONG,Locale.CHINA);//获取时间格式器
result=df.format(d);
System.out.println(result);
NumberFormat nf=NumberFormat.getCurrencyInstance();
double f=56.9;
str=nf.format(f);
System.out.println(str);
NumberFormat nf1=NumberFormat.getPercentInstance(Locale.US);
double f1=0.22;
str=nf1.format(f1);
System.out.println(str);
}
3、文本转化
public static void main(String[] args) {
// TODO Auto-generated method stub
//at
String pattern="At {0},a hurricance {1}";
MessageFormat mf=new MessageFormat(pattern,Locale.US);
Object[] objs={new Date(),new Integer(99)};
String result=mf.format(objs);
System.out.println(result);
}
- 国际化开发类的实例
- web的国际化开发
- JavaWEB开发的国际化
- JavaWEB开发的国际化
- java 中资源国际化工具类的编写实例
- JavaWeb 开发-国际化-DateFormat类(国际化日期)
- Java程序的国际化和本地化实例
- JavaWeb开发-国际化-NumberFormat类
- 国际化开发
- 国际化开发
- 国际化的Struts的开发步骤简介
- 开发符合国际化标准的软件
- iOS开发,装腔的语言国际化
- iOS开发之程序的国际化
- iOS开发 APP的国际化与本地化
- Android 开发之软件的国际化
- Struts2 国际化实例
- Struts1.2国际化实例
- 97. Children are what the mothers are. 耳濡目染,身教言传
- 工作流设计器使用说明
- 世上最伟大的十个公式
- 分页实现的分析
- (2011.10.19-2011.11.15)二十八天的学习小记
- 国际化开发类的实例
- 个人感受
- 揭开正则表达式的神秘面纱
- S3C44b0x BIOS启动参考程序
- ARM MP3解码源代码
- 简单服务端和客户端的开发
- s3c2440 mmc和camera的linux驱动
- ARM 内存管理单元MMU详解
- 使用VS创建开发环境