1 |
/* java.util.Locale |
/* Locale.java -- i18n locales |
2 |
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
72 |
*/ |
*/ |
73 |
public final class Locale implements java.io.Serializable, Cloneable |
public final class Locale implements java.io.Serializable, Cloneable |
74 |
{ |
{ |
75 |
|
// NOTE: These static finals must be initialized with the trusted |
76 |
|
// constructor to avoid bootstrap cycles with String.toUpperCase. |
77 |
|
|
78 |
/** |
/** |
79 |
* Locale which represents the English language. |
* Locale which represents the English language. |
80 |
*/ |
*/ |
81 |
public static final Locale ENGLISH = new Locale("en", ""); |
public static final Locale ENGLISH = new Locale("en", "", true); |
82 |
/** |
/** |
83 |
* Locale which represents the English language. |
* Locale which represents the English language. |
84 |
*/ |
*/ |
85 |
public static final Locale FRENCH = new Locale("fr", ""); |
public static final Locale FRENCH = new Locale("fr", "", true); |
86 |
/** |
/** |
87 |
* Locale which represents the German language. |
* Locale which represents the German language. |
88 |
*/ |
*/ |
89 |
public static final Locale GERMAN = new Locale("de", ""); |
public static final Locale GERMAN = new Locale("de", "", true); |
90 |
/** |
/** |
91 |
* Locale which represents the Italian language. |
* Locale which represents the Italian language. |
92 |
*/ |
*/ |
93 |
public static final Locale ITALIAN = new Locale("it", ""); |
public static final Locale ITALIAN = new Locale("it", "", true); |
94 |
/** |
/** |
95 |
* Locale which represents the Japanese language. |
* Locale which represents the Japanese language. |
96 |
*/ |
*/ |
97 |
public static final Locale JAPANESE = new Locale("ja", ""); |
public static final Locale JAPANESE = new Locale("ja", "", true); |
98 |
/** |
/** |
99 |
* Locale which represents the Korean language. |
* Locale which represents the Korean language. |
100 |
*/ |
*/ |
101 |
public static final Locale KOREAN = new Locale("ko", ""); |
public static final Locale KOREAN = new Locale("ko", "", true); |
102 |
/** |
/** |
103 |
* Locale which represents the Chinese language. |
* Locale which represents the Chinese language. |
104 |
*/ |
*/ |
105 |
public static final Locale CHINESE = new Locale("zh", ""); |
public static final Locale CHINESE = new Locale("zh", "", true); |
106 |
/** |
/** |
107 |
* Locale which represents the Chinese language as used in China. |
* Locale which represents the Chinese language as used in China. |
108 |
*/ |
*/ |
109 |
public static final Locale SIMPLIFIED_CHINESE = new Locale("zh", "CN"); |
public static final Locale SIMPLIFIED_CHINESE = new Locale("zh", "CN", true); |
110 |
/** |
/** |
111 |
* Locale which represents the Chinese language as used in Taiwan. |
* Locale which represents the Chinese language as used in Taiwan. |
112 |
* Same as TAIWAN Locale. |
* Same as TAIWAN Locale. |
113 |
*/ |
*/ |
114 |
public static final Locale TRADITIONAL_CHINESE = new Locale("zh", "TW"); |
public static final Locale TRADITIONAL_CHINESE = new Locale("zh", "TW", true); |
115 |
/** |
/** |
116 |
* Locale which represents France. |
* Locale which represents France. |
117 |
*/ |
*/ |
118 |
public static final Locale FRANCE = new Locale("fr", "FR"); |
public static final Locale FRANCE = new Locale("fr", "FR", true); |
119 |
/** |
/** |
120 |
* Locale which represents Germany. |
* Locale which represents Germany. |
121 |
*/ |
*/ |
122 |
public static final Locale GERMANY = new Locale("de", "DE"); |
public static final Locale GERMANY = new Locale("de", "DE", true); |
123 |
/** |
/** |
124 |
* Locale which represents Italy. |
* Locale which represents Italy. |
125 |
*/ |
*/ |
126 |
public static final Locale ITALY = new Locale("it", "IT"); |
public static final Locale ITALY = new Locale("it", "IT", true); |
127 |
/** |
/** |
128 |
* Locale which represents Japan. |
* Locale which represents Japan. |
129 |
*/ |
*/ |
130 |
public static final Locale JAPAN = new Locale("ja", "JP"); |
public static final Locale JAPAN = new Locale("ja", "JP", true); |
131 |
/** |
/** |
132 |
* Locale which represents Korea. |
* Locale which represents Korea. |
133 |
*/ |
*/ |
134 |
public static final Locale KOREA = new Locale("ko", "KR"); |
public static final Locale KOREA = new Locale("ko", "KR", true); |
135 |
/** |
/** |
136 |
* Locale which represents China. |
* Locale which represents China. |
137 |
* Same as SIMPLIFIED_CHINESE Locale. |
* Same as SIMPLIFIED_CHINESE Locale. |
150 |
/** |
/** |
151 |
* Locale which represents the United Kingdom. |
* Locale which represents the United Kingdom. |
152 |
*/ |
*/ |
153 |
public static final Locale UK = new Locale("en", "GB"); |
public static final Locale UK = new Locale("en", "GB", true); |
154 |
/** |
/** |
155 |
* Locale which represents the United States. |
* Locale which represents the United States. |
156 |
*/ |
*/ |
157 |
public static final Locale US = new Locale("en", "US"); |
public static final Locale US = new Locale("en", "US", true); |
158 |
/** |
/** |
159 |
* Locale which represents the English speaking portion of Canada. |
* Locale which represents the English speaking portion of Canada. |
160 |
*/ |
*/ |
161 |
public static final Locale CANADA = new Locale("en", "CA"); |
public static final Locale CANADA = new Locale("en", "CA", true); |
162 |
/** |
/** |
163 |
* Locale which represents the French speaking portion of Canada. |
* Locale which represents the French speaking portion of Canada. |
164 |
*/ |
*/ |
165 |
public static final Locale CANADA_FRENCH = new Locale("fr", "CA"); |
public static final Locale CANADA_FRENCH = new Locale("fr", "CA", true); |
166 |
|
|
167 |
/** |
/** |
168 |
* We are compatible to sun's Locale. |
* We are compatible to sun's Locale. |
169 |
*/ |
*/ |
170 |
static final long serialVersionUID = 9149081749638150636L; |
private static final long serialVersionUID = 9149081749638150636L; |
171 |
|
|
172 |
/** |
/** |
173 |
* The language code, as returned by getLanguage(). |
* The language code, as returned by getLanguage(). |
230 |
this(language, country, ""); |
this(language, country, ""); |
231 |
} |
} |
232 |
|
|
233 |
|
/** |
234 |
|
* Creates a new locale with trusted versions of the strings. This is |
235 |
|
* necessary to avoid bootstrap cycles with String.toUpperCase. |
236 |
|
* |
237 |
|
* @param language lowercase two-letter ISO-639 A2 language code |
238 |
|
* @param country uppercase two-letter ISO-3166 A2 contry code |
239 |
|
* @param ignored just for the type signature |
240 |
|
* |
241 |
|
*/ |
242 |
|
private Locale(String language, String country, boolean ignored) |
243 |
|
{ |
244 |
|
this.language = language; |
245 |
|
this.country = country; |
246 |
|
variant = ""; |
247 |
|
hashcode = language.hashCode() ^ country.hashCode(); |
248 |
|
} |
249 |
|
|
250 |
private static Locale defaultLocale = |
private static Locale defaultLocale = |
251 |
new Locale(System.getProperty("user.language", ""), |
new Locale(System.getProperty("user.language", ""), |
252 |
System.getProperty("user.region", ""), |
System.getProperty("user.region", ""), true); |
|
System.getProperty("user.variant", "")); |
|
253 |
|
|
254 |
/** |
/** |
255 |
* Returns the default Locale. The default locale is generally |
* Returns the default Locale. The default locale is generally |