]> granicus.if.org Git - icu/commitdiff
ICU-8589 Corrected the condition for using country display name in a time zone partia...
authorYoshito Umaoka <y.umaoka@gmail.com>
Thu, 26 May 2011 19:42:16 +0000 (19:42 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Thu, 26 May 2011 19:42:16 +0000 (19:42 +0000)
X-SVN-Rev: 30147

icu4j/main/classes/core/src/com/ibm/icu/impl/TimeZoneGenericNames.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatTest.java

index 4f96ffd61ebd10789bed0aa572b03658d2e71410..81c6506c69cd5cdbbc3dd4338edef0102794a251 100644 (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) {
index 7499342dfcfe595171ebf59686e03130c38a0514..156e96dcdde8fb1b66c752d49d0c2cc9cbe523f1 100644 (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"},
     };
 
     /**