I list,

I commited the locale changes now as following.


Michael


2005-05-19  Michael Koch  <[EMAIL PROTECTED]>

        * java/text/DateFormatSymbols.java
        (getStringArray): New method.
        (getZoneStrings): Likewise.
        (DateFormatSymbols): Load symbols from properties files.
        * java/util/Locale.java
        (getDisplayLanguage): Handle new way to load language names.
        (getDisplayCountry): Handle new way to load territory names.
        (getDisplayVariant): Handle new way to load variant names.
        * lib/Makefile.am, lib/gen-classlist.sh.in:
        No need to special case classes from gnu.java.locale anymore.
        * scripts/generate-locale-list.sh:
        Generate list from the new properties files.
        * LICENSE: Added license of locale data properties files.

Index: java/text/DateFormatSymbols.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/DateFormatSymbols.java,v
retrieving revision 1.15
diff -u -r1.15 DateFormatSymbols.java
--- java/text/DateFormatSymbols.java    16 Feb 2005 11:18:38 -0000      1.15
+++ java/text/DateFormatSymbols.java    19 May 2005 06:43:20 -0000
@@ -41,6 +41,7 @@
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
+import java.util.StringTokenizer;
 
 /**
  * This class acts as container for locale specific date/time formatting
@@ -78,13 +79,62 @@
   transient String[] dateFormats;
   transient String[] timeFormats;
 
-  private String[] formatsForKey(ResourceBundle res, String key) 
+  private static String[] getStringArray(ResourceBundle res, String name)
+  { 
+    int index = 0;
+    String data = res.getString(name);
+    StringTokenizer st = new StringTokenizer(data, "\u00ae");
+    String[] array = new String[st.countTokens()];
+
+    while (st.hasMoreTokens())
+      {
+        array[index] = st.nextToken();
+       index++;
+      }
+
+    return array;
+  }
+
+  private String[][] getZoneStrings(ResourceBundle res)
   {
-    String[] values = new String [formatPrefixes.length];
-    for (int i = 0; i < formatPrefixes.length; i++)
+    try
+      {
+        int index = 0;
+        String data = res.getString("zoneStrings");
+        StringTokenizer st = new StringTokenizer(data, "\u00ae\u00ae");
+        String[][] array = new String[st.countTokens()][];
+    
+        while (st.hasMoreTokens())
+          {
+           int index2 = 0;
+           String token = st.nextToken();
+           StringTokenizer st2 = new StringTokenizer(token, "\u00ae");
+            array[index] = new String[st2.countTokens()];
+
+           while (st2.hasMoreTokens())
+             {
+                array[index][index2] = st2.nextToken();
+                index2++;
+             }
+
+           index++;
+          }
+    
+        return array;
+      }
+    catch (MissingResourceException e)
       {
-        values[i] = res.getString(formatPrefixes[i]+key);
+       return new String[0][];
       }
+  }
+  
+  private String[] formatsForKey(ResourceBundle res, String key) 
+  {
+    String[] values = new String[formatPrefixes.length];
+    
+    for (int i = 0; i < formatPrefixes.length; i++)
+      values[i] = res.getString(formatPrefixes[i] + key);
+  
     return values;
   }
 
@@ -101,15 +151,14 @@
       = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", locale,
                                 ClassLoader.getSystemClassLoader());
 
-    ampms = res.getStringArray ("ampms");
-    eras = res.getStringArray ("eras");
-    localPatternChars = res.getString ("localPatternChars");
-    months = res.getStringArray ("months");
-    shortMonths = res.getStringArray ("shortMonths");
-    shortWeekdays = res.getStringArray ("shortWeekdays");
-    weekdays = res.getStringArray ("weekdays");
-    zoneStrings = (String[][]) res.getObject ("zoneStrings");
-
+    ampms = getStringArray(res, "ampms");
+    eras = getStringArray(res, "eras");
+    localPatternChars = res.getString("localPatternChars");
+    months = getStringArray(res, "months");
+    shortMonths = getStringArray(res, "shortMonths");
+    shortWeekdays = getStringArray(res, "shortWeekdays");
+    weekdays = getStringArray(res, "weekdays");
+    zoneStrings = getZoneStrings(res);
     dateFormats = formatsForKey(res, "DateFormat");
     timeFormats = formatsForKey(res, "TimeFormat");
   }
Index: java/util/Locale.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Locale.java,v
retrieving revision 1.27
diff -u -r1.27 Locale.java
--- java/util/Locale.java       16 Feb 2005 20:54:25 -0000      1.27
+++ java/util/Locale.java       19 May 2005 06:43:20 -0000
@@ -1,5 +1,5 @@
 /* Locale.java -- i18n locales
-   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2002, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -39,7 +39,6 @@
 package java.util;
 
 import gnu.classpath.SystemProperties;
-import gnu.java.locale.LocaleHelper;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -663,8 +662,19 @@
    */
   public String getDisplayLanguage(Locale inLocale)
   {
-    return LocaleHelper.getLocalizedString(inLocale, language,
-                                          "languages", true, false);
+    try
+      {
+       ResourceBundle res =
+          ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+                                   inLocale,
+                                   ClassLoader.getSystemClassLoader());
+
+        return res.getString("languages." + language);
+      }
+    catch (MissingResourceException e)
+      {
+       return language;
+      }
   }
 
   /**
@@ -710,8 +720,19 @@
    */
   public String getDisplayCountry(Locale inLocale)
   {
-    return LocaleHelper.getLocalizedString(inLocale, country,
-                                           "territories", true, false);
+    try
+      {
+        ResourceBundle res =
+          ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+                                   inLocale,
+                                   ClassLoader.getSystemClassLoader());
+    
+        return res.getString("territories." + country);
+      }
+    catch (MissingResourceException e)
+      {
+        return country;
+      }
   }
 
   /**
@@ -758,8 +779,19 @@
    */
   public String getDisplayVariant(Locale inLocale)
   {
-    return LocaleHelper.getLocalizedString(inLocale, variant, "variants",
-                                          true, false);
+    try
+      {
+        ResourceBundle res =
+          ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+                                   inLocale,
+                                   ClassLoader.getSystemClassLoader());
+    
+        return res.getString("variants." + variant);
+      }
+    catch (MissingResourceException e)
+      {
+        return variant;
+      }
   }
 
   /**
Index: lib/Makefile.am
===================================================================
RCS file: /cvsroot/classpath/classpath/lib/Makefile.am,v
retrieving revision 1.80
diff -u -r1.80 Makefile.am
--- lib/Makefile.am     2 May 2005 17:15:33 -0000       1.80
+++ lib/Makefile.am     19 May 2005 06:43:20 -0000
@@ -14,12 +14,11 @@
 if FOUND_GCJ
 JAVAC = $(GCJ) --bootclasspath '' --classpath $(compile_classpath) -C -d . 
@classes.standard \
 && $(GCJ) -Wno-deprecated --bootclasspath '' --classpath $(compile_classpath) 
-C -d . @classes.awt \
-&& $(GCJ) -Wno-deprecated --bootclasspath '' --classpath $(compile_classpath) 
-C -d . @classes.locale \
 && $(GCJ) -Wno-deprecated --bootclasspath '' --classpath $(compile_classpath) 
-C -d . @classes.xml \
 && $(GCJ) -Wno-deprecated --bootclasspath '' --classpath $(compile_classpath) 
-C -d . @classes.standardx
 else
 if FOUND_JIKES
-JAVAC = $(JIKES) +Pno-shadow +F -bootclasspath '' -extdirs '' -sourcepath '' 
--classpath $(compile_classpath) -d . @classes
+JAVAC = $(JIKES) -nowarn +Pno-shadow +F -bootclasspath '' -extdirs '' 
-sourcepath '' --classpath $(compile_classpath) -d . @classes
 else
 if FOUND_KJC
 JAVAC = $(KJC) -classpath .:$(USER_CLASSLIB) -d . @classes
@@ -113,7 +112,7 @@
 EXTRA_DIST = standard.omit mkcollections.pl.in
 CLEANFILES = compile-classes resources classes \
        classes.standard classes.awt classes.standardx classes.xml \
-       classes.locale glibj.zip classes.1 \
+       glibj.zip classes.1 \
        $(top_builddir)/java/util/LocaleData.java \
        $(JAVA_DEPEND)
 
Index: lib/gen-classlist.sh.in
===================================================================
RCS file: /cvsroot/classpath/classpath/lib/gen-classlist.sh.in,v
retrieving revision 1.22
diff -u -r1.22 gen-classlist.sh.in
--- lib/gen-classlist.sh.in     6 May 2005 14:40:13 -0000       1.22
+++ lib/gen-classlist.sh.in     19 May 2005 06:43:20 -0000
@@ -43,10 +43,8 @@
 # Split in multiple parts for gcj
 grep -v /javax/ classes | grep -v /awt/ \
                         | grep -v /beans/ \
-                        | grep -v /locale/ \
                        | grep -v /xml/ > classes.standard
 grep /awt/ classes > classes.awt
 grep /beans/ classes >> classes.awt
-grep /locale/ classes > classes.locale
 grep /xml/ classes > classes.xml
 grep /javax/ classes | grep -v /xml/ > classes.standardx
Index: scripts/generate-locale-list.sh
===================================================================
RCS file: /cvsroot/classpath/classpath/scripts/generate-locale-list.sh,v
retrieving revision 1.1
diff -u -r1.1 generate-locale-list.sh
--- scripts/generate-locale-list.sh     19 Dec 2004 19:12:14 -0000      1.1
+++ scripts/generate-locale-list.sh     19 May 2005 06:43:20 -0000
@@ -5,7 +5,7 @@
 cd $CLASSPATH_SRCDIR/gnu/java/locale
 
 echo "/* LocaleData.java --"
-echo "   Copyright (C) 2004  Free Software Foundation, Inc."
+echo "   Copyright (C) 2004, 2005  Free Software Foundation, Inc."
 echo
 echo "This file is part of GNU Classpath."
 echo
@@ -52,7 +52,7 @@
 echo "  public static String[] localeNames ="
 echo "    {"
 
-ls LocaleInformation_*.java | xargs -n 1 echo | sed -e 
's/LocaleInformation_\(.*\)\.java/\1/' |
+( cd $CLASSPATH_SRCDIR/resource/gnu/java/locale ; ls LocaleInformation_*.java 
) | xargs -n 1 echo | sed -e 's/LocaleInformation_\(.*\)\.java/\1/' |
 while read locale ; do echo "      \"$locale\"," ; done
 
 echo "    };"
Index: LICENSE
===================================================================
RCS file: /cvsroot/classpath/classpath/LICENSE,v
retrieving revision 1.5
diff -u -r1.5 LICENSE
--- LICENSE     23 Dec 2004 22:38:42 -0000      1.5
+++ LICENSE     19 May 2005 06:43:20 -0000
@@ -246,3 +246,41 @@
   merchantability or fitness for a particular purpose.  Please use it AT
   YOUR OWN RISK.
 
+
+The files in resource/gnu/java/locale were generated by gnu.localegen
+from the files distributed from date provided by CLDR.
+All these files are distributed under the following terms:
+
+  Copyright (C) 1991-2005 Unicode, Inc. All rights reserved. Distributed
+  under the Terms of Use in http://www.unicode.org/copyright.html.
+
+  Permission is hereby granted, free of charge, to any person obtaining
+  a copy of the Unicode data files and any associated documentation (the
+  "Data Files") or Unicode software and any associated documentation
+  (the "Software") to deal in the Data Files or Software without
+  restriction, including without limitation the rights to use, copy,
+  modify, merge, publish, distribute, and/or sell copies of the Data
+  Files or Software, and to permit persons to whom the Data Files or
+  Software are furnished to do so, provided that (a) the above copyright
+  notice(s) and this permission notice appear with all copies of the
+  Data Files or Software, (b) both the above copyright notice(s) and
+  this permission notice appear in associated documentation, and (c)
+  there is clear notice in each modified Data File or in the Software as
+  well as in the documentation associated with the Data File(s) or
+  Software that the data or software has been modified.
+
+  THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+  ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+  WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+  NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
+  ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+  OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
+  SOFTWARE.
+
+  Except as contained in this notice, the name of a copyright holder
+  shall not be used in advertising or otherwise to promote the sale, use
+  or other dealings in these Data Files or Software without prior
+  written authorization of the copyright holder.
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to