Details
-
Bug
-
Resolution: Incomplete
-
P4
-
None
-
5.0
-
x86
-
windows_xp
Description
FULL PRODUCT VERSION :
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
If the JVM's default locale as reported by Locale.getDefault() differs from English (e.g. German), a call to JComponent.setDefaultLocale(Locale.ENGLISH) will not activate English resource strings for the UI components. Instead, the UI will use the resources for the default locale.
This problems arises from the fact that Swing does not include resource bundles especially for English, e.g. there is no "com.sun.swing.internal.plaf.basic.resources.basic_en" in rt.jar. English is only provided via the default bundle. However, the lookup strategy of ResourceBundle.getBundle() will fallback to the default locale if it cannot find a specific bundle for English.
I did not run my application against JDK 6, but just looking at the contents of its rt.jar, it seems to suffer from this problem, too.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
// set non-english default locale
Locale.setDefault(Locale.GERMAN);
// request english ui
JComponent.setDefaultLocale(Locale.ENGLISH);
// BUG: ui will use german, not english
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Forcibly use the default resource bundle via
JComponent.setDefaultLocale(new Locale(""))
Future Swing Release should include (empty) resource bundles for English, whose parents (=default bundle) will actually provide English strings.
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
If the JVM's default locale as reported by Locale.getDefault() differs from English (e.g. German), a call to JComponent.setDefaultLocale(Locale.ENGLISH) will not activate English resource strings for the UI components. Instead, the UI will use the resources for the default locale.
This problems arises from the fact that Swing does not include resource bundles especially for English, e.g. there is no "com.sun.swing.internal.plaf.basic.resources.basic_en" in rt.jar. English is only provided via the default bundle. However, the lookup strategy of ResourceBundle.getBundle() will fallback to the default locale if it cannot find a specific bundle for English.
I did not run my application against JDK 6, but just looking at the contents of its rt.jar, it seems to suffer from this problem, too.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
// set non-english default locale
Locale.setDefault(Locale.GERMAN);
// request english ui
JComponent.setDefaultLocale(Locale.ENGLISH);
// BUG: ui will use german, not english
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Forcibly use the default resource bundle via
JComponent.setDefaultLocale(new Locale(""))
Future Swing Release should include (empty) resource bundles for English, whose parents (=default bundle) will actually provide English strings.