Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

new Locale() from country code, but no lang code?

 
David Balažic
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Is it possible to create a Locale object based only on country code?

java.util.Locale() has either one parameter, the language, or two, lang+country.

In my situation I have a country code, but no lang code.

Is there some getDefaultLanguage(String countryCode) method, that would return the default language for a country?

In short:
- I have : String countryCode
- I need : a Locale object for that country, with the "default" language for that country ("de" for "DE" and "AT", "en" for "GB" etc)

Regards,
David
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no default mechanism for that. However, you could write your own function for this.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic