To reproduce,
import java.applet.Applet;
import java.awt.Graphics;
import java.util.Locale;
import java.lang.System;
public class JavaLocTester extends Applet
{
public void paint(Graphics g)
{
Locale myLocale = Locale.getDefault();
g.drawString("Language: "+ myLocale.getLanguage(), 50, 20);
g.drawString("Country: "+ myLocale.getCountry(), 50, 40);
g.drawString("Variant: "+ myLocale.getVariant(), 50, 60);
g.drawString("toString: "+ myLocale.toString(), 50, 80);
g.drawString("Display Language: "+ myLocale.getDisplayLanguage(), 50,
120);
g.drawString("Display Country: "+ myLocale.getDisplayCountry(), 50,
140);
g.drawString("Display Variant: "+ myLocale.getDisplayVariant(), 50,
160);
}
}
This fails for Windows NT4 Regional Settings Arabic (U.A.E) and Korean. The
Arabic choice correctly returned the Arabic name from the LocaleElements_ar
resource bundle defining the display country translation) with JDK1.1.4FCS
and the Korean choice correctly returned Korean name from LocaleElements_ko
withy JDK1.1.4FCS. However, with JDK1.1.6 Korean and Arabic return KO and U
instead of the respective LocaleElelments country display name.
Other problem languages are:
Albanian
Arabic (all)
Bulgarian
Croatian
Czech
English (Belize)
English (Caribbean)
English (Jamaica)
English (South Africa)
English (Trinidad)
Estonian
Korean
Latvian
Lithuanian
Romanian
Slovak
Slovenian
Spanish (all other than Mexico, Modern Sort, and Traditional Sort)
Swedish (Finland)
===================================================
Note also:
Set the Windows NT4 Regional Setting to Arabic (U.A.E.) and run this program
with appletviewer. The country code returned is U and it should be AE. Of
the many Windows NT4 Arabic Regional Settings (some 16 Arabic ones in total),
UAE is a popular choice amongst Arabic users.
===================================================================
Note also:
When run this program will produce the following java error output in the
MS DOSBOX.
Exception occurred during event dispatching:
java.util.MissingResourceException: Requested resource bundle not installed
at java.lang.Throwable.<init>(Compiled Code)
at java.util.MissingResourceException.<init>(Compiled Code)
at java.util.Locale.getISO2Country(Locale.java:430)
at java.util.Locale.getISO3Country(Locale.java:388)
at JavaLocTester.paint(JavaLocTester.java:19)
at sun.awt.windows.WComponentPeer.handleEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Container.dispatchEventImpl(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
Exception occurred during event dispatching:
java.util.MissingResourceException: Requested resource bundle not installed
at java.lang.Throwable.<init>(Compiled Code)
at java.util.Locale.getISO2Country(Compiled Code)
at JavaLocTester.paint(Compiled Code)
at sun.awt.windows.WComponentPeer.handleEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Container.dispatchEventImpl(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
For some reason this bug fails for the same languages as Oracle bug
675746(Javasoft bug: 4151938).
These bugs may be related. The languages that fail (from bug 675746) are:
Albanian
Arabic (all)
Bulgarian
Croatian
Czech
English (Belize)
English (Caribbean)
English (Jamaica)
English (South Africa)
English (Trinidad)
Estonian
Korean
Latvian
Lithuanian
Romanian
Slovak
Slovenian
Spanish (all other than Mexico, Modern Sort, and Traditional Sort)
Swedish (Finland)
Failure may also be found in the following languages:
French (Luxembourg)
German (Lichtenstien)
German (Luxembourg)
Vietnamese
========================================================================
And an additional piece of information on this bug:
import java.applet.Applet;
import java.awt.Graphics;
import java.util.Locale;
import java.lang.System;
public class JavaLocTester extends Applet
{
public void paint(Graphics g)
{
Locale myLocale = Locale.getDefault();
g.drawString("Language: "+ myLocale.getLanguage(), 50, 20);
g.drawString("Country: "+ myLocale.getCountry(), 50, 40);
g.drawString("Variant: "+ myLocale.getVariant(), 50, 60);
g.drawString("toString: "+ myLocale.toString(), 50, 80);
g.drawString("Display Language: "+ myLocale.getDisplayLanguage(), 50,
120)
g.drawString("Display Country: "+ myLocale.getDisplayCountry(), 50,
140);
g.drawString("Display Variant: "+ myLocale.getDisplayVariant(), 50,
160);
g.drawString("ISO3 Language: "+ myLocale.getISO3Language(), 50, 200);
g.drawString("ISO3 Country: "+ myLocale.getISO3Country(), 50, 220);
}
}
Before running appletviewer be sure to set Windows NT4 Regional Settings to
Korean.
Some investigation of this problem reveal that a possible fix can be made
with
a modification of four strings
"kor", "KO",
"korea", "KO",
"south korea", "KO",
"south-korea", "KO",
in the locale_str.h file in the JVM src/win32/java/include directory.
=========================================================================