2362N/A * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A @summary test ISO639-2 language codes 0N/A @run main Bug4175998Test 0N/A * (C) Copyright IBM Corp. 1998 - All Rights Reserved 0N/A * The original version of this source code and documentation is 0N/A * copyrighted and owned by IBM. These materials are provided 0N/A * under terms of a License Agreement between IBM and Sun. 0N/A * This technology is protected by multiple US and International 0N/A * patents. This notice and attribution to IBM may not be removed. 0N/A * Bug4175998Test verifies that the following bug has been fixed: 0N/A * Bug 4175998 - The java.util.Locale.getISO3Language() returns wrong result for a locale with 0N/A * language code 'ta'(Tamil). 0N/A //generateTables(); //uncomment this to regenerate data tables 0N/A logln(
"Locale("+l+
") returned bad ISO3 language code." 0N/A errln(
"Bad ISO3 language codes detected.");
0N/A The following code was used to generate the table above from the two ISO standards. 0N/A It matches the language names (not the codes) from both standards to associate 0N/A the two and three letter codes. 0N/A private static void generateTables() { 0N/A BufferedReader ISO639File = new BufferedReader(new FileReader(ISO639)); 0N/A Hashtable i639 = new Hashtable(); 0N/A for (String line = ISO639File.readLine(); line != null; line = ISO639File.readLine()) { 0N/A if (!line.startsWith("#")) { 0N/A final int ndx = line.indexOf(' '); 0N/A final String arg1 = line.substring(0, ndx); 0N/A final int ndx2 = line.indexOf(' ', ndx+1); 0N/A final String arg2 = line.substring(ndx+1, ndx2 < 0 ? line.length() : ndx2); 0N/A i639.put(arg1, arg2); 0N/A BufferedReader ISO6392File = new BufferedReader(new FileReader(ISO6392)); 0N/A Hashtable i6392 = new Hashtable(); 0N/A for (String line = ISO6392File.readLine(); line != null; line = ISO6392File.readLine()) { 0N/A final int ndx = line.indexOf(' '); 0N/A final int ndx2 = line.indexOf(' ', ndx+1); 0N/A int ndx3 = line.indexOf(' ', ndx2+1); 0N/A if (ndx3 < 0) ndx3 = line.length(); 0N/A final String arg1 = line.substring(0, ndx); 0N/A final String arg2 = line.substring(ndx+1, ndx2); 0N/A final String arg3 = line.substring(ndx2+1, ndx3); 0N/A i6392.put(arg3, new ISO6392Entry(arg1, arg2)); 0N/A Enumeration keys = i639.keys(); 0N/A while (keys.hasMoreElements()) { 0N/A final Object key = keys.nextElement(); 0N/A final Object name = i639.get(key); 0N/A final Object value = i6392.get(name); 0N/A if (value != null) { 0N/A System.out.print("{"); 0N/A System.out.print("\""+key+"\","); 0N/A System.out.print(value); 0N/A System.out.println("},"); 0N/A } catch (Exception e) { 0N/A System.out.println(e); 0N/A private static final class ISO6392Entry { 0N/A public final String code; 0N/A public final String name; 0N/A public ISO6392Entry(String code, String name) { 0N/A public String toString() { 0N/A return "\""+code+"\",\""+name+"\""; 0N/Aafa afa Afro-Asiatic (Other) 0N/Aalg alg Algonquian languages 0N/Aang ang English-Old (ca. 450-1100) 0N/Aapa apa Apache languages 0N/Aart art Artificial (Other) 0N/Aath ath Athapascan languages 0N/Aaus aus Australian languages 0N/Abai bai Bamileke languages 0N/Abat bat Baltic (Other) 0N/Aber ber Berber (Other) 0N/Abnt bnt Bantu (Other) 0N/Abtk btk Batak (Indonesia) 0N/Acai cai Central-American-Indian (Other) 0N/Acau cau Caucasian (Other) 0N/Acel cel Celtic (Other) 0N/Achn chn Chinook-jargon 0N/Achu chu Church-Slavic 0N/Acmc cmc Chamic languages 0N/Acpe cpe Creoles-and-pidgins-English-based (Other) 0N/Acpf cpf Creoles-and-pidgins-French-based (Other) 0N/Acpp cpp Creoles-and-pidgins-Portuguese-based (Other) 0N/Acrp crp Creoles-and-pidgins (Other) 0N/Acus cus Cushitic (Other) 0N/Aden den Slave (Athapascan) 0N/Adra dra Dravidian (Other) 0N/Adum dum Dutch-Middle (ca. 1050-1350) 0N/Aegy egy Egyptian (Ancient) 0N/Aell gre Greek Modern (post 1453) 0N/Aenm enm English-Middle (1100-1500) 0N/Afiu fiu Finno-Ugrian (Other) 0N/Afrm frm French-Middle (ca. 1400-1600) 0N/Afro fro French-Old (842-ca. 1400) 0N/Agem gem Germanic (Other) 0N/Agmh gmh German-Middle High (ca. 1050-1500) 0N/Agoh goh German-Old High (ca. 750-1050) 0N/Agrc grc Greek-Ancient (to 1453) 0N/Aina ina Interlingua (International Auxilary Language Association) 0N/Ainc inc Indic (Other) 0N/Aine ine Indo-European (Other) 0N/Aira ira Iranian (Other) 0N/Airo iro Iroquoian languages 0N/Ajpr jpr Judeo-Persian 0N/Akhi khi Khoisan (Other) 0N/Altz ltz Letzeburgesch 0N/Aluo luo Luo (Kenya and Tanzania) 0N/Amap map Austronesian (Other) 0N/Amga mga Irish-Middle (900-1200) 0N/Amis mis Miscellaneous languages 0N/Amkh mkh Mon-Khmer (Other) 0N/Amno mno Manobo languages 0N/Amul mul Multiple languages 0N/Amun mun Munda languages 0N/Amyn myn Mayan languages 0N/Anai nai North American Indian (Other) 0N/Anbl nbl Ndebele, South 0N/Ande nde Ndebele, North 0N/Anic nic Niger-Kordofanian (Other) 0N/Anso nso Sohto, Northern 0N/Anub nub Nubian languages 0N/Aoci oci Occitan (post 1500) 0N/Aota ota Turkish, Ottoman (1500-1928) 0N/Aoto oto Otomian languages 0N/Apaa paa Papuan (Other) 0N/Apeo peo Persian, Old (ca. 600-400 B.C.) 0N/Aphi phi Philippine (Other) 0N/Apra pra Prakrit languages 0N/Apro pro Proven�al, Old (to 1500) 0N/Aqaa-qtz qaa-qtz Reserved for local use 0N/Aroa roa Romance (Other) 0N/Aroh roh Raeto-Romance 0N/Asai sai South American Indian (Other) 0N/Asal sal Salishan languages 0N/Asam sam Samaritan Aramaic 0N/Asem sem Semitic (Other) 0N/Asga sga Irish-Old (to 900) 0N/Asio sio Siouan languages 0N/Asit sit Sino-Tibetan (Other) 0N/Asla sla Slavic (Other) 0N/Asmi smi Sami languages 0N/Asot sot Sotho Southern 0N/Assa ssa Nilo-Saharan (Other) 0N/Atog tog Tonga (Nyasa) 0N/Aton ton Tonga (Tonga Islands)