diff options
author | Michael Koch <konqueror@gmx.de> | 2005-05-25 05:40:48 +0000 |
---|---|---|
committer | Michael Koch <konqueror@gmx.de> | 2005-05-25 05:40:48 +0000 |
commit | 84c221dcc5f90415e7839d7bb823a7de8803bef3 (patch) | |
tree | 2d8d43abaa81ff5a93c1c6573b779bd8137fb2d0 /java | |
parent | a3ce320fb2bc5d2ea8d5c662b2295cb8c8d77e7f (diff) | |
download | classpath-84c221dcc5f90415e7839d7bb823a7de8803bef3.tar.gz |
2005-05-25 Michael Koch <konqueror@gmx.de>
* java/util/Locale.java (getISOStrings):
Re-implemented for locale properties files.
Diffstat (limited to 'java')
-rw-r--r-- | java/util/Locale.java | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/java/util/Locale.java b/java/util/Locale.java index 691cb9712..9ec847146 100644 --- a/java/util/Locale.java +++ b/java/util/Locale.java @@ -453,33 +453,35 @@ public final class Locale implements Serializable, Cloneable */ private static String[] getISOStrings(String tableName) { - List tempList; - ResourceBundle bundle; - Enumeration keys; int count = 0; - String[] strings; + ResourceBundle bundle = + ResourceBundle.getBundle("gnu.java.locale.LocaleInformation"); + Enumeration e = bundle.getKeys(); + ArrayList tempList = new ArrayList(); - tempList = new ArrayList(); - bundle = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation"); - keys = ((Hashtable) bundle.getObject(tableName)).keys(); - while (keys.hasMoreElements()) + while (e.hasMoreElements()) { - String nextString; - - nextString = (String) keys.nextElement(); - if (nextString.length() == 2 && - Character.isLetter(nextString.charAt(0)) && - Character.isLetter(nextString.charAt(1))) + String key = (String) e.nextElement(); + + if (key.startsWith(tableName + ".")) { - tempList.add(nextString); - ++count; + String str = key.substring(tableName.length() + 1); + + if (str.length() == 2 + && Character.isLetter(str.charAt(0)) + && Character.isLetter(str.charAt(1))) + { + tempList.add(str); + ++count; + } } } - strings = new String[count]; + + String[] strings = new String[count]; + for (int a = 0; a < count; ++a) - { - strings[a] = (String) tempList.get(a); - } + strings[a] = (String) tempList.get(a); + return strings; } |