Dim
Dim

Reputation: 4807

Country name in English

I am trying to get country name from country code. For example:

Locale locale = new Locale("", "FR"); locale.getDisplayName()

So, I get France. But, when my phone in other language, it get the name in local language. So when my phone is in Hebrew I get צרפת which in Hebrew is France. But I wish to get the name always in English. I have tried:

Locale locale = new Locale("en_US", "FR");
Locale locale = new Locale("en", "FR");

But It just not working.

Upvotes: 1

Views: 355

Answers (1)

Khalid Taha
Khalid Taha

Reputation: 3313

You need to add the English locale as parameter to the method as following:

String france = new Locale("", "FR").getDisplayCountry(Locale.ENGLISH); // France

Or the method you used:

String france = new Locale("", "FR").getDisplayName(Locale.ENGLISH); // France

Upvotes: 3

Related Questions