国际化与格式化(2):MessageFormat
来源:互联网 发布:城市联合网络电视台 编辑:程序博客网 时间:2024/05/16 01:04
mess_en_US.properties :
msg=Hello {0}! now the time is {1}.mess_zh_CN.properties :
msg=\u4f60\u597d{0}!\u73b0\u5728\u65f6\u95f4\u662f{1}.MessageFormatDemo.java :
public class MessageFormatDemo {public static void main(String[] args) {Locale locale=Locale.getDefault();ResourceBundle bundle=ResourceBundle.getBundle("mess",locale);String str=bundle.getString("msg");System.out.println(MessageFormat.format(str,"Tom",new Date()));System.out.println(MessageFormat.format(str,"Sun",new Date()));}}
在控制面板里将操作系统的语言环境改为美国英文,再次运行程序输出:
- 国际化与格式化(2):MessageFormat
- 国际化之MessageFormat与占位符
- 国际化动态文本(MessageFormat)
- MessageFormat带参数格式化
- 使用MessageFormat格式化数字,日期
- MessageFormat类:快速格式化字符串
- JAVA:MessageFormat格式化文字输出
- 国际化与格式化(1):完成程序的国际化
- Java —— MessageFormat类 处理国际化
- 国际化 格式化
- Java中的格式化-MessageFormat,NumberFormat,DateFormat
- MessageFormat
- MessageFormat
- MessageFormat与占位符使用
- 国际化与格式化(0):Java国际化的思路及支持的国家和语言
- javaweb国际化/格式化标签
- 国际化/格式化标签
- 国际化-日期格式化
- 我为什么看好青芒果式的创新
- hdu 4438 Hunters
- HTK 第二章 HTK工具包概述
- oracle执行sql查询语句的步骤
- TCP三次握手/四次挥手
- 国际化与格式化(2):MessageFormat
- Android 众多的布局属性详解
- fgets和feof
- Ubuntu12.04编译Android4.0.1源码全过程-----附wubi安装ubuntu编译android源码硬盘空间不够的问题解决
- 如何选购VPS虚拟专用服务器
- 我所理解的设计模式(C++实现)——观察者模式(Observer Pattern)
- Java反射实例
- shell中if做比较
- java常用类解析一