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: Default Locale for United Kingdom



Bill Tschumy <email@hidden> wrote:

>I have been modifying my application to correctly deal with the
>user's locale.  It is working fine on Windows, but On Mac OS X I keep
>getting the default locale to be en_US even though I have set my
>"British English" to be my top language preference.  If I set the
>language preference to France, I do get the correct French local and
>date formatting.
>
>In my program I have the following debug line:
>
>         System.out.println(Locale.getDefault());
>
>This always prints en_US even when I have British English chosen.
>Any thoughts on how to get en-UK to appear?

Which versions of Java and OS?

Also, "en-UK" isn't a well-formed Locale name.  It'd be "en_UK", with an
underbar, not a hyphen.  Also. "UK" will work only if "UK" is the
country/region being assigned to the system property.  In my experience (on
10.3.* and earlier), "British English" results in "GB", not "UK".  YMMV, so
it's best to check.

AFAIK, Java's default Locale depends on two things, regardless of platform:
  1) the values of several "user.*" system properties.
  2) the presence of Locale bundles.

The first is easy to check.  Simply print the relevant "user.*" properties,
and confirm whether or not they are affected by changes to the Languages
list.  Changes to the Languages list only appear the next time a Java app
is launched: there's no dynamic update.

The second is also easy to check.  Simply enumerate all the Locales, via
Locale.getAvailableLocales(), and print out their toString() values.  If
there isn't one for the system property values you saw before, then it's a
Locale-availability problem.  If the system property values aren't being
set to match Languages, it's a JVM problem.

If there is a bug in the JVM, it's a new one, because this all works fine
on 10.3 and earlier, with J2SE 1.3 or 1.4, in my experience.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



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.