ICU-4175 conform to mark's latest revision of tr35-J
X-SVN-Rev: 18301
This commit is contained in:
parent
b716b6c920
commit
5bf5294916
@ -527,8 +527,8 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
{ "en", "Europe/London", "2004-07-15T00:00:00Z", "z", "BST", "Europe/London" },
|
||||
{ "en", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "British Summer Time", "Europe/London" },
|
||||
// icu en.txt has exemplar city for this time zone
|
||||
{ "en", "Europe/London", "2004-07-15T00:00:00Z", "v", "London", "Europe/London" },
|
||||
{ "en", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "London", "Europe/London" },
|
||||
{ "en", "Europe/London", "2004-07-15T00:00:00Z", "v", "United Kingdom", "Europe/London" },
|
||||
{ "en", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "United Kingdom", "Europe/London" },
|
||||
|
||||
/* ibm JDK 1.4.2 doesn't support this timezone id
|
||||
{ "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
|
||||
@ -647,8 +647,8 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
{ "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" },
|
||||
{ "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6\u95f4", "America/Los_Angeles" },
|
||||
// icu zh.txt has exemplar city for this time zone
|
||||
{ "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u6d1b\u6749\u77f6", "America/Los_Angeles" },
|
||||
{ "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u6d1b\u6749\u77f6", "America/Los_Angeles" },
|
||||
{ "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u6d1b\u6749\u77f6 (\u7f8e\u56fd)", "America/Los_Angeles" },
|
||||
{ "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u6d1b\u6749\u77f6 (\u7f8e\u56fd)", "America/Los_Angeles" },
|
||||
|
||||
/* JDK 1.5 doesn't support this time zone id
|
||||
{ "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
|
||||
@ -839,8 +839,8 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
{ "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" },
|
||||
{ "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u0422\u0438\u0445\u043e\u043e\u043a\u0435\u0430\u043d\u0441\u043a\u0430 \u043b\u044f\u0442\u043d\u0430 \u0447\u0430\u0441\u043e\u0432\u0430 \u0437\u043e\u043d\u0430", "America/Los_Angeles" },
|
||||
// icu bg.txt has exemplar city for this time zone
|
||||
{ "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441", "America/Los_Angeles" },
|
||||
{ "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441", "America/Los_Angeles" },
|
||||
{ "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441 (\u0421\u0410\u0429)", "America/Los_Angeles" },
|
||||
{ "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u041b\u043e\u0441 \u0410\u043d\u0436\u0435\u043b\u0438\u0441 (\u0421\u0410\u0429)", "America/Los_Angeles" },
|
||||
|
||||
/* JDK 1.5 doesn't support this time zone id
|
||||
{ "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
|
||||
@ -939,8 +939,8 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
{ "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\u592a\u5e73\u6d0b\u590f\u6642\u9593", "America/Los_Angeles" },
|
||||
// icu ja.txt has exemplar city for this time zone
|
||||
// we use the region format for this case, and so append \u6642\u9593 to the result, i.e. this translates as "Los Angeles Time"
|
||||
{ "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9\u6642\u9593", "America/Los_Angeles" },
|
||||
{ "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9\u6642\u9593", "America/Los_Angeles" },
|
||||
{ "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9 (\u30A2\u30E1\u30EA\u30AB\u5408\u8846\u56FD)\u6642\u9593", "America/Los_Angeles" },
|
||||
{ "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\u30ed\u30b5\u30f3\u30bc\u30eb\u30b9 (\u30A2\u30E1\u30EA\u30AB\u5408\u8846\u56FD)\u6642\u9593", "America/Los_Angeles" },
|
||||
|
||||
/* JDK 1.5 doesn't support this time zone id
|
||||
{ "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
|
||||
|
@ -172,45 +172,6 @@ public final class ZoneMeta {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// translation of appendix j
|
||||
// A) "Canonicalize the olson ID"
|
||||
// --> map the passed-in id to an olson id.
|
||||
// A.1) if there is no such id, goto C (GMT)
|
||||
//
|
||||
// B) "If there is an exact translation in the resolved locale, use it"
|
||||
// --> get the zone info data for this locale. check to see if it came from a
|
||||
// fallback of this locale (and didn't go up the defaultLocale chain). (note: record this as 'IS_VALID')
|
||||
// B.1) if it did, check to see that the requested form is available (long/short, generic/standard/daylight)
|
||||
// B.1.a) if it is, return it.
|
||||
//
|
||||
// C) "For non-wall-time, use GMT format"
|
||||
// --> if not generic, look up GMT format, translation, and hours, format the offset value, and return.
|
||||
//
|
||||
// D) "If there is an exemplar city, use the region format"
|
||||
// --> look up the exemplar city, and if found, look up region format, format the city, and return.
|
||||
//
|
||||
// E) "If there is a country for the time zone..."
|
||||
// --> the time zone is not associated with 'no country' (note: record this as 'COUNTRY_CODE')
|
||||
// "and a translation in the locale for the country name..."
|
||||
// --> if IS_VALID (see B) and there is a translation for the country (note: record this as 'COUNTRY')
|
||||
// "and the country has one modern time zone or is in the singleCountries list..."
|
||||
// --> if the info is marked true for this time zone
|
||||
// "use it with the region format"
|
||||
// --> look up the region format, format the country, and return.
|
||||
//
|
||||
// F) "If it is a perpetual alias..."
|
||||
// --> no idea what this means, so skip
|
||||
//
|
||||
// G) "Fall back to the raw Olson ID, using the fallback format
|
||||
// --> convert the tail of the time zone id to a city string as described (note: record this as 'CITY')
|
||||
// G.1 if (COUNTRY is null) set COUNTRY to COUNTRY_CODE
|
||||
// G.2 else format the city and country using the fallback format, and return.
|
||||
//
|
||||
// H) "Else use the (possibly multi-offset) GMT format
|
||||
// --> else no country? but we've fallen back to the raw olson id... how do we reach this point?
|
||||
// --> also, it sounds like i'd need to examine the GMT format string to see if it is multi-offset or not
|
||||
|
||||
private static String[] getCanonicalInfo(String id) {
|
||||
if (canonicalMap == null) {
|
||||
Map m = new HashMap();
|
||||
@ -272,7 +233,7 @@ public final class ZoneMeta {
|
||||
/**
|
||||
* Handle fallbacks for generic time (rules E.. G)
|
||||
*/
|
||||
public static String displayFallback(String tzid, ULocale locale) {
|
||||
public static String displayFallback(String tzid, String city, ULocale locale) {
|
||||
String[] info = getCanonicalInfo(tzid);
|
||||
if (info == null) {
|
||||
return null; // error
|
||||
@ -307,20 +268,19 @@ public final class ZoneMeta {
|
||||
return displayRegion(country_code, locale);
|
||||
}
|
||||
}
|
||||
// if (country != null && info[2] != null) { // single country
|
||||
// return displayRegion(country, locale);
|
||||
// }
|
||||
|
||||
String city = tzid.substring(tzid.lastIndexOf('/')+1);
|
||||
int n;
|
||||
if ((n = city.indexOf('_')) != -1) {
|
||||
char[] chars = city.toCharArray();
|
||||
for (; n < chars.length; ++n) {
|
||||
if (chars[n] == '_') {
|
||||
chars[n] = ' ';
|
||||
if (city == null) {
|
||||
city = tzid.substring(tzid.lastIndexOf('/')+1);
|
||||
int n;
|
||||
if ((n = city.indexOf('_')) != -1) {
|
||||
char[] chars = city.toCharArray();
|
||||
for (; n < chars.length; ++n) {
|
||||
if (chars[n] == '_') {
|
||||
chars[n] = ' ';
|
||||
}
|
||||
}
|
||||
city = new String(chars);
|
||||
}
|
||||
city = new String(chars);
|
||||
}
|
||||
|
||||
if (country == null) {
|
||||
|
@ -829,6 +829,7 @@ public class SimpleDateFormat extends DateFormat {
|
||||
}
|
||||
}
|
||||
|
||||
String city = null;
|
||||
if (zs != null) {
|
||||
if (isGeneric) {
|
||||
if (zs.length >= 7) { // have generic strings
|
||||
@ -838,7 +839,7 @@ public class SimpleDateFormat extends DateFormat {
|
||||
}
|
||||
res = zs[ix];
|
||||
} else if (zs.length == 6) { // have city string
|
||||
res = ZoneMeta.displayRegion(zs[5], locale);
|
||||
city = zs[5];
|
||||
}
|
||||
} else {
|
||||
int ix = count < 4 ? 2 : 1;
|
||||
@ -856,7 +857,7 @@ public class SimpleDateFormat extends DateFormat {
|
||||
cal.get(Calendar.DST_OFFSET);
|
||||
res = ZoneMeta.displayGMT(offset, locale);
|
||||
} else {
|
||||
res = ZoneMeta.displayFallback(tzid, locale);
|
||||
res = ZoneMeta.displayFallback(tzid, city, locale);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user