ICU-7882 Enable BCP47 ids and update a few test cases in ICU4J.

X-SVN-Rev: 28502
This commit is contained in:
Michael Ow 2010-08-20 19:35:16 +00:00
parent be123c47b5
commit e9ef072967
3 changed files with 14 additions and 4 deletions

View file

@ -829,10 +829,17 @@ public final class ULocale implements Serializable {
* @stable ICU 3.0
*/
public static String getName(String localeID){
String name = nameCache.get(localeID);
String tmpLocaleID;
// Convert BCP47 id if necessary
if (localeID != null && localeID.contains("-u-") && !localeID.contains("@")) {
tmpLocaleID = forLanguageTag(localeID).getName();
} else {
tmpLocaleID = localeID;
}
String name = nameCache.get(tmpLocaleID);
if (name == null) {
name = new LocaleIDParser(localeID).getName();
nameCache.put(localeID, name);
name = new LocaleIDParser(tmpLocaleID).getName();
nameCache.put(tmpLocaleID, name);
}
return name;
}

View file

@ -1002,6 +1002,7 @@ public class IBMCalendarTest extends CalendarTest {
"en_US_VALLEYGIRL@collation=phonebook;calendar=gregorian",
"ja_JP@calendar=japanese",
"th_TH@calendar=buddhist",
"th-TH-u-ca-gregory",
"ja_JP_TRADITIONAL",
"th_TH_TRADITIONAL",
"th_TH_TRADITIONAL@calendar=gregorian",
@ -1018,6 +1019,7 @@ public class IBMCalendarTest extends CalendarTest {
"gregorian",
"japanese",
"buddhist",
"gregorian",
"japanese",
"buddhist",
"gregorian",

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2002-2009, International Business Machines
* Copyright (c) 2002-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -217,6 +217,7 @@ public class CurrencyTest extends TestFmwk {
{ "eo_AO", "1979-12-29", "AOK" },
{ "eo_AO", "1969-12-31" },
{ "eo_DE@currency=DEM", "2000-12-23", "EUR", "DEM" },
{ "eo-DE-u-cu-dem", "2000-12-23", "EUR", "DEM" },
{ "en_US", null, "USD" },
{ "en_US_PREEURO", null, "USD" },
{ "en_US_Q", null, "USD" },