diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | java/text/DateFormatSymbols.java | 65 |
2 files changed, 42 insertions, 30 deletions
@@ -1,6 +1,13 @@ 2008-07-07 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/text/DateFormatSymbols.java: + (getZoneStrings(ResourceBundle,Locale)): + Fallback on to parent locales. + +2008-07-07 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * java/text/DateFormatSymbols.java: + (getZoneStrings(ResourceBundle,Locale)): Use metazones to convert metazone names to standard Continent/City form. Also add hack to include GMT as a short name. diff --git a/java/text/DateFormatSymbols.java b/java/text/DateFormatSymbols.java index 5e7a39ebe..cdd95ff2f 100644 --- a/java/text/DateFormatSymbols.java +++ b/java/text/DateFormatSymbols.java @@ -135,39 +135,44 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable List<String[]> allZones = new ArrayList<String[]>(); try { - int index = 0; - String country = locale.getCountry(); Map<String,String[]> systemZones = new HashMap<String,String[]>(); - String data = res.getString("zoneStrings"); - String[] zones = data.split("\u00a9"); - for (int a = 0; a < zones.length; ++a) + while (true) { - String[] strings = zones[a].split("\u00ae"); - // Workaround for missing short GMT display name - // See http://www.unicode.org/cldr/bugs/locale-bugs/incoming?id=1885 - if (strings[0].equals("GMT")) - strings[2] = "GMT"; - String type = properties.getProperty(strings[0] + "." + country); - if (type == null) - type = properties.getProperty(strings[0] + ".DEFAULT"); - if (type != null) - strings[0] = type; - if (strings.length < 5) + int index = 0; + String country = locale.getCountry(); + String data = res.getString("zoneStrings"); + String[] zones = data.split("\u00a9"); + for (int a = 0; a < zones.length; ++a) { - String[] newStrings = new String[5]; - System.arraycopy(strings, 0, newStrings, 0, strings.length); - for (int b = strings.length; b < newStrings.length; ++b) - newStrings[b] = ""; - strings = newStrings; - } - String[] existing = systemZones.get(strings[0]); - if (existing != null && existing.length > 1) - { - for (int b = 1; b < existing.length; ++b) - if (!existing[b].equals("")) - strings[b] = existing[b]; + String[] strings = zones[a].split("\u00ae"); + String type = properties.getProperty(strings[0] + "." + country); + if (type == null) + type = properties.getProperty(strings[0] + ".DEFAULT"); + if (type != null) + strings[0] = type; + if (strings.length < 5) + { + String[] newStrings = new String[5]; + System.arraycopy(strings, 0, newStrings, 0, strings.length); + for (int b = strings.length; b < newStrings.length; ++b) + newStrings[b] = ""; + strings = newStrings; + } + String[] existing = systemZones.get(strings[0]); + if (existing != null && existing.length > 1) + { + for (int b = 1; b < existing.length; ++b) + if (!existing[b].equals("")) + strings[b] = existing[b]; + } + systemZones.put(strings[0], strings); } - systemZones.put(strings[0], strings); + if (res.getLocale() == Locale.ROOT) + break; + else + res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", + LocaleHelper.getFallbackLocale(res.getLocale()), + ClassLoader.getSystemClassLoader()); } allZones.addAll(systemZones.values()); } @@ -245,9 +250,9 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable shortMonths = getStringArray(res, "shortMonths"); shortWeekdays = getStringArray(res, "shortWeekdays"); weekdays = getStringArray(res, "weekdays"); - runtimeZoneStrings = getZoneStrings(res, locale); dateFormats = formatsForKey(res, "DateFormat"); timeFormats = formatsForKey(res, "TimeFormat"); + runtimeZoneStrings = getZoneStrings(res, locale); } /** |