• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about locale

 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
i use chinese windows2000 operating system,see my following code:

import java.text.DateFormat;
import java.util.*;
public class MyDate {

public static void main(String[] argv){

Locale countries[];
Locale locale=new Locale("en");
countries=locale.getAvailableLocales();
for(int i=0;i<countries.length;i++){
System.out.println(countries[i].getDisplayCountry());
}
}
}


i want to display english country name list,but it always give me the chinese name,why?
thank you!
 
John Spindler
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what exactly you are asking to do here but if it is to show all countries that use the English Language then you should use the getDisplayLanguage() method, like so:

Hope that helps.. if not let me know.

Slight edit to fit in page width -- Carl
[ April 08, 2002: Message edited by: Carl Trusiak ]
 
zhebincong
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to display all of the countries in the world by using english,not only the countries that speak english!
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answered here.
Also, please read our user name policy here and modify your display name accordingly. We need to see a space between Zhebin and Cong. Thanks.
[ April 08, 2002: Message edited by: Jim Yingst ]
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to adjust your base Locale. This is what controls the display. I tried to use Chinese for the example but, I don't have a character set to handle that so, I used French instead.
Just before your loop call:
Locale.setDefault(Locale.FRENCH);
You can use any of the constants such as ENGLISH Since my base local is that, I shifted it to French to see the difference.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic