[loc-en-dev] Locale.getDisplayScript()
Yoshito Umaoka
y.umaoka at gmail.com
Thu Aug 4 15:07:37 PDT 2011
It looks Locale.getDisplayScript() (no args) does not honor default
DISPLAY locale.
The code snippet below illustrates the issue.
Locale loc = Locale.forLanguageTag("zh-Hans-CN");
// Set default locale to en-US
Locale.setDefault(Locale.US);
System.out.println("Default Locale: en-US");
System.out.println(" langauge: " + loc.getDisplayLanguage());
System.out.println(" script: " + loc.getDisplayScript());
// Set DISPLAY locale to zh-Hans-CN
Locale.setDefault(Category.DISPLAY, loc);
System.out.println("Default DISPLAY Locale: zh-Hans-CN");
System.out.println(" langauge: " + loc.getDisplayLanguage());
System.out.println(" script: " + loc.getDisplayScript());
// Set default locale to zh-Hans-CN
Locale.setDefault(loc);
System.out.println("Default Locale: zh-Hans-CN");
System.out.println(" langauge: " + loc.getDisplayLanguage());
System.out.println(" script: " + loc.getDisplayScript());
This code prints out -
Default Locale: en-US
langauge: Chinese
script: Simplified Han
Default DISPLAY Locale: zh-Hans-CN
langauge: 中文
script: Simplified Han
Default Locale: zh-Hans-CN
langauge: 中文
script: 简体中文
I'm going to file a bug.
-Yoshito
More information about the locale-enhancement-dev
mailing list