Java 取得系統的 Language 語系、Territory 地區別

在 Java 中, 可以利用 Locale 來取得相關 Language 語系與 Territory 地區別,

範例, 參考如下 :
 程式碼
Locale currentLocale = Locale.getDefault();
 
System.out.println( "currentLocale: " + currentLocale );
System.out.println( "DisplayName: " + currentLocale.getDisplayName() );
 
System.out.println( "Language: " + currentLocale.getLanguage() );
System.out.println( "DisplayLanguage: " + currentLocale.getDisplayLanguage() );
 
System.out.println( "Country: " + currentLocale.getCountry() );
System.out.println( "DisplayCountry: " + currentLocale.getDisplayCountry() );

範例結果, 如下 :
Related Posts Plugin for WordPress, Blogger...