java i18n demo,Java国际化(i18n) Locale类详细示例

在这个例子中,将获得默认的语言环境并打印其详细信息。 然后为“fr”创建一个语言环境并打印其详细信息。

文件:I18NTester.java -

import java.util.Locale;

public class I18NTester {

public static void main(String[] args) {

Locale locale =Locale.getDefault();

System.out.println("Default Locale Properties:\n");

System.out.println(locale.getDisplayCountry());

System.out.println(locale.getDisplayLanguage());

System.out.println(locale.getDisplayName());

System.out.println(locale.getISO3Country());

System.out.println(locale.getISO3Language());

System.out.println(locale.getLanguage());

System.out.println(locale.getCountry());

Locale frenchLocale = new Locale("fr","fr");

System.out.println("\nfr Locale Properties:\n");

System.out.println(frenchLocale.getDisplayCountry());

System.out.println(frenchLocale.getDisplayLanguage());

System.out.println(frenchLocale.getDisplayName());

System.out.println(frenchLocale.getISO3Country());

System.out.println(frenchLocale.getISO3Language());

System.out.println(frenchLocale.getLanguage());

System.out.println(frenchLocale.getCountry());

}

}

执行上面示例代码,得到以下结果 -

Default Locale Properties:

中国

中文

中文 (中国)

CHN

zho

zh

CN

fr Locale Properties:

法国

法文

法文 (法国)

FRA

fra

fr

FR

b739ec46bb5c46d9c0aa4ce35ba1ea56.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值