ICU-8589 Corrected the condition for using country display name in a time zone partial location name.

X-SVN-Rev: 30147
This commit is contained in:
Yoshito Umaoka 2011-05-26 19:42:16 +00:00
parent a198e88f64
commit 356c5f4528
2 changed files with 14 additions and 3 deletions

View file

@ -534,9 +534,17 @@ public class TimeZoneGenericNames implements Serializable, Freezable<TimeZoneGen
return name;
}
String location = null;
String countryCode = ZoneMeta.getSingleCountry(tzID);
String countryCode = ZoneMeta.getCanonicalCountry(tzID);
if (countryCode != null) {
location = getLocaleDisplayNames().regionDisplayName(countryCode);
// Is this the golden zone for the region?
String regionalGolden = _tznames.getReferenceZoneID(mzID, countryCode);
if (tzID.equals(regionalGolden)) {
// Use country name
location = getLocaleDisplayNames().regionDisplayName(countryCode);
} else {
// Otherwise, use exemplar city name
location = _tznames.getExemplarLocationName(tzID);
}
} else {
location = _tznames.getExemplarLocationName(tzID);
if (location == null) {

View file

@ -1448,7 +1448,10 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
{ "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
{ "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "(IN)", "Asia/Calcutta" },
{ "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "(IN)", "Asia/Calcutta" },
// Ticket#8589 Partial location name to use country name if the zone is the golden
// zone for the time zone's country.
{ "en_MX", "America/Chicago", "1995-07-15T00:00:00Z", "vvvv", "Central Time (United States)", "America/Chicago"},
};
/**