- Java 國際化教程
- Java I18N - 首頁
- Java I18N - 概述
- Java I18N - 環境設定
- Locale 類示例
- Java I18N - Locale 類
- Java I18N - 地區設定詳情
- Java I18N - 顯示語言
- ResourceBundle 類示例
- Java I18N - ResourceBundle 類
- NumberFormat 類示例
- Java I18N - NumberFormat 類
- Java I18N - 格式化貨幣
- Java I18N - 格式化百分比
- Java I18N - 設定最小/最大精度
- Java I18N - 設定舍入模式
- Java I18N - 解析數字
- DecimalFormat 類示例
- Java I18N - DecimalFormat 類
- Java I18N - 格式化模式
- Java I18N - 地區特定的 DecimalFormat
- Java I18N - DecimalFormatSymbols 類
- Java I18N - 分組數字
- DateFormat 類示例
- Java Java - DateFormat 類
- Java I18N - 格式化日期
- Java I18N - 格式化時間
- Java I18N - 格式化日期和時間
- SimpleDateFormat 類示例
- Java I18N - SimpleDateFormat 類
- Java I18N - 格式化日期
- Java I18N - DateFormatSymbols 類
- Java I18N - 日期格式模式
- 時區示例
- Java I18N - UTC
- Unicode 轉換
- Java I18N - 從字串到字串轉換
- Java I18N - 從 Reader 到 Writer 轉換
- 相關教程
- Java 教程
- JDBC 教程
- Swing 教程
- AWT 教程
- Servlet 教程
- JSP 教程
- Java I18N 有用資源
- Java I18N - 快速指南
- Java I18N - 有用資源
- Java I18N - 討論
Java 國際化 - 地區設定詳情
示例
在這個示例中,我們將獲取預設的區域設定並列印其詳細資訊。然後為“fr”建立一個區域設定並列印其詳細資訊。
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: United States English English (United States) USA eng en US fr Locale Properties: France French French (France) FRA fra fr FR
廣告