LoginSignup
1
0

More than 3 years have passed since last update.

Localeオブジェクトの取得

Posted at

Localeとは

 国や言語で分けた「地域」を表す情報のこと。ロケールはjava.util.Localeクラスのオブジェクトで表す。

Localeオブジェクトの取得 その1

Myclass.java
Locale loc = new Locale("ja"); //ja
Locale loc = new Locale("en","US"); //en_US
Locale loc = new Locale("fr","CA","POSIX"); //fr_CA_POSIX

Localeオブジェクトの取得 その2

Myclass.java
Local loc = new Locale.Builder().setLanguage("ja").setRegion("JP").build();
//ja_JP

まとめ

ロケールオブジェクトの取得に関して、上記2パターンあることを頭に置いておくべし。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0