File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes question about locale Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "question about locale" Watch "question about locale" New topic

question about locale

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
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");
for(int i=0;i<countries.length;i++){

i want to display english country name list,but it always give me the chinese name,why?
thank you!
John Spindler

Joined: Feb 12, 2002
Posts: 28
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 ]

Joined: Jan 14, 2002
Posts: 11
i want to display all of the countries in the world by using english,not only the countries that speak english!
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
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 ]

"I'm not back." - Bill Harding, Twister
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
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:
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.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
I agree. Here's the link:
subject: question about locale
It's not a secret anymore!