KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > juddi > util > Language


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.juddi.util;
17
18 import java.lang.reflect.Field JavaDoc;
19
20 /**
21  * An utility class for dealing with language codes.
22  *
23  * @author Steve Viens (sviens@apache.org)
24  */

25 public class Language
26 {
27   public static final String JavaDoc ABKHAZIAN = "ab";
28   public static final String JavaDoc AFAR = "aa";
29   public static final String JavaDoc AFRIKAANS = "af";
30   public static final String JavaDoc ALBANIAN = "sq";
31   public static final String JavaDoc AMHARIC = "am";
32   public static final String JavaDoc ARABIC = "ar";
33   public static final String JavaDoc ARMENIAN = "hy";
34   public static final String JavaDoc ASSAMESE = "as";
35   public static final String JavaDoc AYMARA = "ay";
36   public static final String JavaDoc AZERBAIJANI = "az";
37   public static final String JavaDoc BASHKIR = "ba";
38   public static final String JavaDoc BASQUE = "eu";
39   public static final String JavaDoc BENGALI = "bn";
40   public static final String JavaDoc BHUTANI = "dz";
41   public static final String JavaDoc BIHARI = "bh";
42   public static final String JavaDoc BISLAMA = "bi";
43   public static final String JavaDoc BRETON = "br";
44   public static final String JavaDoc BULGARIAN = "bg";
45   public static final String JavaDoc BURMESE = "my";
46   public static final String JavaDoc BYELORUSSIAN = "be";
47   public static final String JavaDoc CAMBODIAN = "km";
48   public static final String JavaDoc CATALAN = "ca";
49   public static final String JavaDoc CHINESE = "zh";
50   public static final String JavaDoc CORSICAN = "co";
51   public static final String JavaDoc CROATION = "hr";
52   public static final String JavaDoc CZECH = "cs";
53   public static final String JavaDoc DANISCH = "da";
54   public static final String JavaDoc DUTCH = "nl";
55   public static final String JavaDoc ENGLISH = "en";
56   public static final String JavaDoc ESPERANTO = "eo";
57   public static final String JavaDoc ESTONIAN = "et";
58   public static final String JavaDoc FAEROESE = "fo";
59   public static final String JavaDoc FARSI = "fa";
60   public static final String JavaDoc FIJI = "fj";
61   public static final String JavaDoc FINNISH = "fi";
62   public static final String JavaDoc FRENCH = "fr";
63   public static final String JavaDoc FRISIAN = "fy";
64   public static final String JavaDoc GALICIAN = "gl";
65   public static final String JavaDoc GEORGIAN = "ka";
66   public static final String JavaDoc GERMAN = "de";
67   public static final String JavaDoc GREEK = "el";
68   public static final String JavaDoc GREENLANDIC = "kl";
69   public static final String JavaDoc GUARANI = "gn";
70   public static final String JavaDoc GUJARATI = "gu";
71   public static final String JavaDoc HAUSA = "ha";
72   public static final String JavaDoc HEBREW = "iw";
73   public static final String JavaDoc HEBREW_2 = "he";
74   public static final String JavaDoc HINDI = "hi";
75   public static final String JavaDoc HUNGARIAN = "hu";
76   public static final String JavaDoc ICELANDIC = "is";
77   public static final String JavaDoc INDONESIAN = "in";
78   public static final String JavaDoc INDONESIAN_2 = "id";
79   public static final String JavaDoc INTERLINGUA = "ia";
80   public static final String JavaDoc INTERLINGUE = "ie";
81   public static final String JavaDoc INUKTITUT = "iu";
82   public static final String JavaDoc INUPIAK = "ik";
83   public static final String JavaDoc IRISH = "ga";
84   public static final String JavaDoc ITALIAN = "it";
85   public static final String JavaDoc JAPANESE = "ja";
86   public static final String JavaDoc JAVANESE = "jw";
87   public static final String JavaDoc KANNADA = "kn";
88   public static final String JavaDoc KASHMIRI = "ks";
89   public static final String JavaDoc KAZAKH = "kk";
90   public static final String JavaDoc KINYARWANDA = "rw";
91   public static final String JavaDoc KIRGHIZ = "ky";
92   public static final String JavaDoc KIRUNDI = "rn";
93   public static final String JavaDoc KOREAN = "ko";
94   public static final String JavaDoc KURDISH = "ku";
95   public static final String JavaDoc LAOTHIAN = "lo";
96   public static final String JavaDoc LATIN = "la";
97   public static final String JavaDoc LATVIAN = "lv";
98   public static final String JavaDoc LINGALA = "ln";
99   public static final String JavaDoc LITHUANIAN = "lt";
100   public static final String JavaDoc MACEDONIAN = "mk";
101   public static final String JavaDoc MALAGASY = "mg";
102   public static final String JavaDoc MALAY = "ms";
103   public static final String JavaDoc MALAYALAM = "ml";
104   public static final String JavaDoc MALTESE = "mt";
105   public static final String JavaDoc MANX_GAELIC = "gv";
106   public static final String JavaDoc MAORI = "mi";
107   public static final String JavaDoc MARATHI = "mr";
108   public static final String JavaDoc MOLDAVIAN = "mo";
109   public static final String JavaDoc MONGOLIAN = "mn";
110   public static final String JavaDoc NAURU = "na";
111   public static final String JavaDoc NEPALI = "ne";
112   public static final String JavaDoc NORWEGIAN = "no";
113   public static final String JavaDoc OCCITAN = "oc";
114   public static final String JavaDoc ORIYA = "or";
115   public static final String JavaDoc OROMO = "om";
116   public static final String JavaDoc PASHTO = "ps";
117   public static final String JavaDoc POLISH = "pl";
118   public static final String JavaDoc PORTUGUESE = "pt";
119   public static final String JavaDoc PUNJABI = "pa";
120   public static final String JavaDoc QUECHUA = "qu";
121   public static final String JavaDoc RHAETO_ROMANCE = "rm";
122   public static final String JavaDoc ROMANIAN = "ro";
123   public static final String JavaDoc RUSSIAN = "ru";
124   public static final String JavaDoc SAMOAN = "sm";
125   public static final String JavaDoc SANGRO = "sg";
126   public static final String JavaDoc SANSKRIT = "sa";
127   public static final String JavaDoc SCOTS_GAELIC = "gd";
128   public static final String JavaDoc SERBIAN = "sr";
129   public static final String JavaDoc SERBO_CROATIAN = "sh";
130   public static final String JavaDoc SESOTHO = "st";
131   public static final String JavaDoc SETSWANA = "tn";
132   public static final String JavaDoc SHONA = "sn";
133   public static final String JavaDoc SINDHI = "sd";
134   public static final String JavaDoc SINGHALESE = "si";
135   public static final String JavaDoc SISWATI = "ss";
136   public static final String JavaDoc SLOVAK = "sk";
137   public static final String JavaDoc SLOVENIAN = "sl";
138   public static final String JavaDoc SOMALI = "so";
139   public static final String JavaDoc SPANISH = "es";
140   public static final String JavaDoc SUNDANESE = "su";
141   public static final String JavaDoc SWAHILI = "sw";
142   public static final String JavaDoc SWEDISH = "sv";
143   public static final String JavaDoc TAGALOG = "tl";
144   public static final String JavaDoc TAJIK = "tg";
145   public static final String JavaDoc TAMIL = "ta";
146   public static final String JavaDoc TATAR = "tt";
147   public static final String JavaDoc TELUGU = "te";
148   public static final String JavaDoc THAI = "th";
149   public static final String JavaDoc TIBETAN = "bo";
150   public static final String JavaDoc TIGRINYA = "ti";
151   public static final String JavaDoc TONGA = "to";
152   public static final String JavaDoc TSONGA = "ts";
153   public static final String JavaDoc TURKISH = "tr";
154   public static final String JavaDoc TURKMEN = "tk";
155   public static final String JavaDoc TWI = "tw";
156   public static final String JavaDoc UIGHUR = "ug";
157   public static final String JavaDoc UKRAINIAN = "uk";
158   public static final String JavaDoc URDU = "ur";
159   public static final String JavaDoc UZBEK = "uz";
160   public static final String JavaDoc VIETNAMESE = "vi";
161   public static final String JavaDoc VOLAPUK = "vo";
162   public static final String JavaDoc WELSH = "cy";
163   public static final String JavaDoc WOLOF = "wo";
164   public static final String JavaDoc XHOSA = "xh";
165   public static final String JavaDoc YIDDISH = "ji";
166   public static final String JavaDoc YIDDISH_2 = "yi";
167   public static final String JavaDoc YORUBA = "yo";
168   public static final String JavaDoc ZULU = "zu";
169
170   /**
171    * Checks if the given code is a valid ISO language code.
172    * @return True if the code is a valid language code, false otherwise.
173    */

174   public static boolean isLanguageCode(String JavaDoc code)
175   {
176     // check this using the reflection API
177
try
178     {
179       Field JavaDoc[] codes = Language.class.getFields();
180
181       for (int i=0; i<codes.length; i++)
182       {
183         if (codes[i].get(null).equals(code))
184           return true;
185       }
186     }
187     catch (IllegalAccessException JavaDoc e) { }
188
189     return false;
190   }
191 }
Popular Tags