位置:首页 > Java技术 > Java.util包 > java.util.Locale.getISOLanguages()方法实例

java.util.Locale.getISOLanguages()方法实例

java.util.Locale.getISOLanguages() 方法返回ISO 639中定义的所有两字母语言代码。可用于创建语言环境的列表。

声明

以下是java.util.Locale.getISOLanguages()方法的声明

public static String[] getISOLanguages()

参数

  • NA

返回值

此方法不返回任何值。

异常

  • NA

例子

下面的示例演示java.util.Locale.getISOLanguages​​()方法的用法。

package com.yiibai;

import java.util.*;

public class LocaleDemo {

   public static void main(String[] args) {

      // create a new locale
      Locale locale = new Locale("en", "US", "WIN");

      // print locale
      System.out.println("Locale:" + locale);

      // get ISO languages
      String[] languages = Locale.getISOLanguages();

      // print countries
      System.out.println("Languages are:");
      for (int i = 0; i < languages.length; i++) {
         System.out.println(i + ":" + languages[i]);
      }
   }
}

让我们来编译和运行上面的程序,这将产生以下结果:

Locale:en_US_WIN
Languages are:
0:aa
1:ab
2:ae
3:af
4:ak
5:am
6:an
7:ar
8:as
9:av
10:ay
11:az
12:ba
13:be
14:bg
15:bh
16:bi
17:bm
18:bn
19:bo
20:br
21:bs
22:ca
23:ce
24:ch
25:co
26:cr
27:cs
28:cu
29:cv
30:cy
31:da
32:de
33:dv
34:dz
35:ee
36:el
37:en
38:eo
39:es
40:et
41:eu
42:fa
43:ff
44:fi
45:fj
46:fo
47:fr
48:fy
49:ga
50:gd
51:gl
52:gn
53:gu
54:gv
55:ha
56:he
57:hi
58:ho
59:hr
60:ht
61:hu
62:hy
63:hz
64:ia
65:id
66:ie
67:ig
68:ii
69:ik
70:in
71:io
72:is
73:it
74:iu
75:iw
76:ja
77:ji
78:jv
79:ka
80:kg
81:ki
82:kj
83:kk
84:kl
85:km
86:kn
87:ko
88:kr
89:ks
90:ku
91:kv
92:kw
93:ky
94:la
95:lb
96:lg
97:li
98:ln
99:lo
100:lt
101:lu
102:lv
103:mg
104:mh
105:mi
106:mk
107:ml
108:mn
109:mo
110:mr
111:ms
112:mt
113:my
114:na
115:nb
116:nd
117:ne
118:ng
119:nl
120:nn
121:no
122:nr
123:nv
124:ny
125:oc
126:oj
127:om
128:or
129:os
130:pa
131:pi
132:pl
133:ps
134:pt
135:qu
136:rm
137:rn
138:ro
139:ru
140:rw
141:sa
142:sc
143:sd
144:se
145:sg
146:si
147:sk
148:sl
149:sm
150:sn
151:so
152:sq
153:sr
154:ss
155:st
156:su
157:sv
158:sw
159:ta
160:te
161:tg
162:th
163:ti
164:tk
165:tl
166:tn
167:to
168:tr
169:ts
170:tt
171:tw
172:ty
173:ug
174:uk
175:ur
176:uz
177:ve
178:vi
179:vo
180:wa
181:wo
182:xh
183:yi
184:yo
185:za
186:zh
187:zu