Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DateFormat using language=English and country=Italy



<email@hidden> wrote:

>Running a getDisplayCountry on the default locale I get "United States".
>It's correct?

It is. It's what you asked for, though you may not know how.


>The result is that "DateFormat.getTimeInstance().format(new Date())"
>returns me a time with a 12 hour style clock, while in my system
>preferences I've 24 hour style clock.

The time and date format you specify in System Preferences cannot be made
available to a Java program as a Locale, because Java's Locales don't work
that way. Specifically, there is no way to designate a specific time,
date, currency, list-separator, or any other individual preference that
deviates from the Locale's resources for those things. More specifically,
there isn't a Locale for Italian English, or Americano Italiano.

The only thing a Java program sees is a Locale: either the default Locale,
or a Locale it retrieves by name. The default Locale is determined by two
system properties: "user.country" and "user.language" on J2SE 1.4.

The only System Preferences setting that affects "user.country" and
"user.language" is in the International pane, under the Language tab, the
top-most item in the Languages list. For example, drag British English to
the top of the list and your default Java Locale will change to en_GB at
the next Java-app launch. You can examine the properties to see this
change, too.

Your only other choice is to create a custom Locale that has overrides of
the things you want different. You still won't get that Locale by default,
because the default is still determined by the Language tab's choice, but
you can select the new Locale manually, or override the properties in
"Info.plist".

Search the archives for "Locale" to find past askings and answerings of
this question. Why it isn't a FAQ yet I don't know.

-- GG
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.