| 1 |
/* |
| 2 |
* Copyright (C) 2013 The Android Open Source Project |
| 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 |
|
| 17 |
package com.android.ide.common.resources; |
| 18 |
|
| 19 |
import static java.util.Locale.US; |
| 20 |
|
| 21 |
import com.android.annotations.NonNull; |
| 22 |
import com.android.annotations.Nullable; |
| 23 |
import com.android.annotations.VisibleForTesting; |
| 24 |
import com.android.ide.common.res2.ResourceRepository; |
| 25 |
import com.android.resources.ResourceType; |
| 26 |
import com.android.utils.SdkUtils; |
| 27 |
import com.google.common.base.Splitter; |
| 28 |
import com.google.common.collect.ListMultimap; |
| 29 |
import com.google.common.collect.Lists; |
| 30 |
import com.google.common.collect.Sets; |
| 31 |
|
| 32 |
import java.util.Arrays; |
| 33 |
import java.util.Collections; |
| 34 |
import java.util.List; |
| 35 |
import java.util.Locale; |
| 36 |
import java.util.Set; |
| 37 |
import java.util.TimeZone; |
| 38 |
|
| 39 |
/** |
| 40 |
* The {@linkplain LocaleManager} provides access to locale information such as |
| 41 |
* language names and language to region name mappings for the various locales. |
| 42 |
*/ |
| 43 |
public class LocaleManager { |
| 44 |
/** Utility methods only */ |
| 45 |
private LocaleManager() { |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Returns the name of the given region for a 2 letter region code, in English. |
| 50 |
* |
| 51 |
* @param regionCode the 2 letter region code (ISO 3166-1 alpha-2), |
| 52 |
* or the 3 letter region ode (ISO 3166-2 alpha-3) |
| 53 |
* @return the name of the given region for a region code, in English, or |
| 54 |
* null if not known |
| 55 |
*/ |
| 56 |
@Nullable |
| 57 |
public static String getRegionName(@NonNull String regionCode) { |
| 58 |
if (regionCode.length() == 2) { |
| 59 |
assert Character.isUpperCase(regionCode.charAt(0)) |
| 60 |
&& Character.isUpperCase(regionCode.charAt(1)) : regionCode; |
| 61 |
int index = Arrays.binarySearch(ISO_3166_1_CODES, regionCode); |
| 62 |
if (index < 0 || index >= ISO_3166_1_TO_2.length) { |
| 63 |
return null; |
| 64 |
} |
| 65 |
return ISO_3166_2_NAMES[ISO_3166_1_TO_2[index]]; |
| 66 |
} else if (regionCode.length() == 3) { |
| 67 |
assert Character.isUpperCase(regionCode.charAt(0)) |
| 68 |
&& Character.isUpperCase(regionCode.charAt(1)) |
| 69 |
&& Character.isUpperCase(regionCode.charAt(2)) : regionCode; |
| 70 |
int index = Arrays.binarySearch(ISO_3166_2_CODES, regionCode); |
| 71 |
if (index < 0) { |
| 72 |
return null; |
| 73 |
} |
| 74 |
return ISO_3166_2_NAMES[index]; |
| 75 |
} |
| 76 |
|
| 77 |
return null; |
| 78 |
} |
| 79 |
|
| 80 |
/** |
| 81 |
* Returns the name of the given language for a language code, in English. |
| 82 |
* |
| 83 |
* @param languageCode the 2 letter language code (ISO 639-1), or |
| 84 |
* 3 letter language code (ISO 639-2) |
| 85 |
* @return the name of the given language for a language code, in English, or |
| 86 |
* null if not known |
| 87 |
*/ |
| 88 |
@Nullable |
| 89 |
public static String getLanguageName(@NonNull String languageCode) { |
| 90 |
if (languageCode.length() == 2) { |
| 91 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 92 |
&& Character.isLowerCase(languageCode.charAt(1)) : languageCode; |
| 93 |
int index = Arrays.binarySearch(ISO_639_1_CODES, languageCode); |
| 94 |
if (index < 0 || index >= ISO_639_1_TO_2.length) { |
| 95 |
return null; |
| 96 |
} |
| 97 |
return ISO_639_2_NAMES[ISO_639_1_TO_2[index]]; |
| 98 |
} else if (languageCode.length() == 3) { |
| 99 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 100 |
&& Character.isLowerCase(languageCode.charAt(1)) |
| 101 |
&& Character.isLowerCase(languageCode.charAt(2)) : languageCode; |
| 102 |
int index = Arrays.binarySearch(ISO_639_2_CODES, languageCode); |
| 103 |
if (index < 0) { |
| 104 |
return null; |
| 105 |
} |
| 106 |
return ISO_639_2_NAMES[index]; |
| 107 |
} |
| 108 |
|
| 109 |
return null; |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* Returns all the known language codes |
| 114 |
* |
| 115 |
* @return all the known language codes |
| 116 |
*/ |
| 117 |
@NonNull |
| 118 |
public static List<String> getLanguageCodes() { |
| 119 |
return getLanguageCodes(false); |
| 120 |
} |
| 121 |
|
| 122 |
/** |
| 123 |
* Returns all the known language codes |
| 124 |
* |
| 125 |
* @param include3 If true, include 3-letter language codes as well (for |
| 126 |
* languages not available as 2-letter languages) |
| 127 |
* @return all the known language codes |
| 128 |
*/ |
| 129 |
@NonNull |
| 130 |
public static List<String> getLanguageCodes(boolean include3) { |
| 131 |
if (!include3) { |
| 132 |
return Arrays.asList(ISO_639_1_CODES); |
| 133 |
} else { |
| 134 |
List<String> codes = Lists.newArrayListWithExpectedSize(ISO_639_2_CODES.length); |
| 135 |
for (int i = 0; i < ISO_639_2_TO_1.length; i++) { |
| 136 |
int iso2 = ISO_639_2_TO_1[i]; |
| 137 |
if (iso2 != -1) { |
| 138 |
codes.add(ISO_639_1_CODES[iso2]); |
| 139 |
} else { |
| 140 |
codes.add(ISO_639_2_CODES[i]); |
| 141 |
} |
| 142 |
} |
| 143 |
return codes; |
| 144 |
} |
| 145 |
} |
| 146 |
|
| 147 |
/** |
| 148 |
* Returns all the known region codes |
| 149 |
* |
| 150 |
* @return all the known region codes |
| 151 |
*/ |
| 152 |
@NonNull |
| 153 |
public static List<String> getRegionCodes() { |
| 154 |
return getRegionCodes(false); |
| 155 |
} |
| 156 |
|
| 157 |
/** |
| 158 |
* Returns all the known region codes |
| 159 |
* |
| 160 |
* @param include3 If true, include 3-letter region codes as well (for |
| 161 |
* regions not available as 2-letter regions) |
| 162 |
* @return all the known region codes |
| 163 |
*/ |
| 164 |
@NonNull |
| 165 |
public static List<String> getRegionCodes(boolean include3) { |
| 166 |
if (!include3) { |
| 167 |
return Arrays.asList(ISO_3166_1_CODES); |
| 168 |
} else { |
| 169 |
List<String> codes = Lists.newArrayListWithExpectedSize(ISO_3166_2_CODES.length); |
| 170 |
for (int i = 0; i < ISO_3166_2_TO_1.length; i++) { |
| 171 |
int iso2 = ISO_3166_2_TO_1[i]; |
| 172 |
if (iso2 != -1) { |
| 173 |
codes.add(ISO_3166_1_CODES[iso2]); |
| 174 |
} else { |
| 175 |
codes.add(ISO_3166_2_CODES[i]); |
| 176 |
} |
| 177 |
} |
| 178 |
return codes; |
| 179 |
} |
| 180 |
} |
| 181 |
|
| 182 |
/** |
| 183 |
* Returns true if the given language code represents a valid/known 2 or 3 letter |
| 184 |
* language code. (By convention, language codes should be lower case.) |
| 185 |
* |
| 186 |
* @param languageCode the language code to look up |
| 187 |
* @return true if this is a known language |
| 188 |
*/ |
| 189 |
public static boolean isValidLanguageCode(@NonNull String languageCode) { |
| 190 |
if (languageCode.length() == 2) { |
| 191 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 192 |
&& Character.isLowerCase(languageCode.charAt(1)) : languageCode; |
| 193 |
return Arrays.binarySearch(ISO_639_1_CODES, languageCode) >= 0; |
| 194 |
} else if (languageCode.length() == 3) { |
| 195 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 196 |
&& Character.isLowerCase(languageCode.charAt(1)) |
| 197 |
&& Character.isLowerCase(languageCode.charAt(2)) : languageCode; |
| 198 |
return Arrays.binarySearch(ISO_639_2_CODES, languageCode) >= 0; |
| 199 |
} |
| 200 |
|
| 201 |
return false; |
| 202 |
} |
| 203 |
|
| 204 |
/** |
| 205 |
* Returns true if the given region code represents a valid/known 2 or 3 letter |
| 206 |
* region code. (By convention, region codes should be upper case.) |
| 207 |
* |
| 208 |
* @param regionCode the region code to look up |
| 209 |
* @return true if this is a known region |
| 210 |
*/ |
| 211 |
public static boolean isValidRegionCode(@NonNull String regionCode) { |
| 212 |
if (regionCode.length() == 2) { |
| 213 |
assert Character.isUpperCase(regionCode.charAt(0)) |
| 214 |
&& Character.isUpperCase(regionCode.charAt(1)) : regionCode; |
| 215 |
return Arrays.binarySearch(ISO_3166_1_CODES, regionCode) >= 0; |
| 216 |
} else if (regionCode.length() == 3) { |
| 217 |
assert Character.isUpperCase(regionCode.charAt(0)) |
| 218 |
&& Character.isUpperCase(regionCode.charAt(1)) |
| 219 |
&& Character.isUpperCase(regionCode.charAt(2)) : regionCode; |
| 220 |
return Arrays.binarySearch(ISO_3166_2_CODES, regionCode) >= 0; |
| 221 |
} |
| 222 |
|
| 223 |
return false; |
| 224 |
} |
| 225 |
|
| 226 |
/** |
| 227 |
* Returns the region code for the given language. <b>Note that there can be |
| 228 |
* many regions that speak a given language; this just picks one</b> based |
| 229 |
* on a set of heuristics. |
| 230 |
* |
| 231 |
* @param languageCode the language to look up |
| 232 |
* @return the corresponding region code, if any |
| 233 |
*/ |
| 234 |
@Nullable |
| 235 |
public static String getLanguageRegion(@NonNull String languageCode) { |
| 236 |
return getLanguageRegion(languageCode, null); |
| 237 |
} |
| 238 |
|
| 239 |
/** |
| 240 |
* Like {@link #getLanguageRegion(String)}, but does not take user preferences |
| 241 |
* and locations into consideration. |
| 242 |
*/ |
| 243 |
@Nullable |
| 244 |
public static String getDefaultLanguageRegion(@NonNull String languageCode) { |
| 245 |
if (languageCode.length() == 2) { |
| 246 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 247 |
&& Character.isLowerCase(languageCode.charAt(1)) : languageCode; |
| 248 |
int index = Arrays.binarySearch(ISO_639_1_CODES, languageCode); |
| 249 |
if (index < 0 || index >= ISO_639_1_TO_2.length) { |
| 250 |
return null; |
| 251 |
} |
| 252 |
int regionIndex = LANGUAGE_REGION[ISO_639_1_TO_2[index]]; |
| 253 |
if (regionIndex != -1) { |
| 254 |
int twoLetterIndex = ISO_3166_2_TO_1[regionIndex]; |
| 255 |
if (twoLetterIndex != -1) { |
| 256 |
return ISO_3166_1_CODES[twoLetterIndex]; |
| 257 |
} else { |
| 258 |
return ISO_3166_2_CODES[regionIndex]; |
| 259 |
} |
| 260 |
} |
| 261 |
return null; |
| 262 |
} else if (languageCode.length() == 3) { |
| 263 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 264 |
&& Character.isLowerCase(languageCode.charAt(1)) |
| 265 |
&& Character.isLowerCase(languageCode.charAt(2)) : languageCode; |
| 266 |
int index = Arrays.binarySearch(ISO_639_2_CODES, languageCode); |
| 267 |
if (index < 0) { |
| 268 |
return null; |
| 269 |
} |
| 270 |
return getRegionCode(LANGUAGE_REGION[index]); |
| 271 |
} |
| 272 |
|
| 273 |
assert false : languageCode; |
| 274 |
return null; |
| 275 |
} |
| 276 |
|
| 277 |
/** |
| 278 |
* Returns the region code for the given language. <b>Note that there can be |
| 279 |
* many regions that speak a given language; this just picks one</b> based |
| 280 |
* on a set of heuristics. |
| 281 |
* |
| 282 |
* @param languageCode the language to look up |
| 283 |
* @return the corresponding region code, if any |
| 284 |
*/ |
| 285 |
@Nullable |
| 286 |
public static String getLanguageRegion(@NonNull String languageCode, |
| 287 |
@Nullable ResourceRepository resources) { |
| 288 |
// Try to pick one language based on various heuristics: |
| 289 |
|
| 290 |
// (1) Check to see if the user has deliberately picked a preferred |
| 291 |
// region for this language with an option. That should always |
| 292 |
// win. Example: STUDIO_LOCALES="en_GB,pt_PT" says that for English |
| 293 |
// we should always use the region GB and for Portuguese we should always |
| 294 |
// use the region PT. Also allow en-GB and en-rGB. |
| 295 |
String option = System.getenv("STUDIO_LOCALES"); |
| 296 |
if (option == null) { |
| 297 |
option = System.getProperty("studio.locales"); |
| 298 |
} |
| 299 |
if (option != null) { |
| 300 |
for (String regionLocale : Splitter.on(',').trimResults().split(option)) { |
| 301 |
if (SdkUtils.startsWithIgnoreCase(regionLocale, languageCode)) { |
| 302 |
if (regionLocale.length() == 5 && ((regionLocale.charAt(2) == '_') |
| 303 |
|| regionLocale.charAt(2) == '-')) { |
| 304 |
return regionLocale.substring(3).toUpperCase(US); |
| 305 |
} else if (regionLocale.length() == 6 && regionLocale.charAt(2) == '-' |
| 306 |
&& regionLocale.charAt(3) == 'r') { |
| 307 |
return regionLocale.substring(4).toUpperCase(US); |
| 308 |
} |
| 309 |
} |
| 310 |
} |
| 311 |
} |
| 312 |
|
| 313 |
// (2) Check the user's locale; if it happens to be in the same language |
| 314 |
// as the target language, and it specifies a region, use that region |
| 315 |
Locale locale = Locale.getDefault(); |
| 316 |
if (languageCode.equalsIgnoreCase(locale.getLanguage())) { |
| 317 |
String country = locale.getCountry(); |
| 318 |
if (!country.isEmpty()) { |
| 319 |
country = country.toUpperCase(US); |
| 320 |
if (country.length() == 2) { |
| 321 |
return country; |
| 322 |
} |
| 323 |
} |
| 324 |
} |
| 325 |
|
| 326 |
// Do we have multiple known regions for this locale? If so, try to pick |
| 327 |
// among them based on heuristics. |
| 328 |
List<String> regions = getRelevantRegions(languageCode); |
| 329 |
if (regions.size() > 1) { |
| 330 |
// Some languages are used in a huge number of regions (English is |
| 331 |
// in 90+ regions for example), and similarly, some regions have multiple |
| 332 |
// major languages (Switzerland for example). In these cases we don't want |
| 333 |
// to show a region flag for the local region (e.g. for Switzerland you |
| 334 |
// would see the same flag for German, French, Italian, ...). |
| 335 |
// Therefore, only use region lookup for a subset of languages where |
| 336 |
// we're not sure. |
| 337 |
List<String> relevant = getDisambiguateRegions(languageCode); |
| 338 |
|
| 339 |
// (3) Check the user's country. The user may not be using the target |
| 340 |
// language, but if the current country matches one of the relevant |
| 341 |
// regions, use it. |
| 342 |
String country = locale.getCountry(); |
| 343 |
if (!country.isEmpty() && relevant != null) { |
| 344 |
country = country.toUpperCase(US); |
| 345 |
if (country.length() == 2 && regions.contains(country) && |
| 346 |
(relevant.isEmpty() || relevant.contains(country))) { |
| 347 |
return country; |
| 348 |
} |
| 349 |
} |
| 350 |
|
| 351 |
// (4) Look at the user's network location; if we can resolve |
| 352 |
// the domain name, the TLD might be an ISO 3166 country code: |
| 353 |
// http://en.wikipedia.org/wiki/Country_code_top-level_domain |
| 354 |
// If so, and that country code is in one of the candidate regions, |
| 355 |
// use it. (Note the exceptions listed in there; we should treat |
| 356 |
// "uk" as "gb" for ISO code lookup.) |
| 357 |
// |
| 358 |
// NOTE DONE: It turns out this is tricky. Looking up the current domain |
| 359 |
// typically requires a network connection, sometimes it can |
| 360 |
// take seconds, and even the domain name may not be helpful; |
| 361 |
// it may be for example a .com address. |
| 362 |
|
| 363 |
|
| 364 |
// (5) Use the timezone! The timezone can give us a very good clue |
| 365 |
// about the region. In many cases we can get an exact match, |
| 366 |
// e.g. if we're looking at the timezone Europe/Lisbon we know |
| 367 |
// the region is PT. (In the future we could extend this to |
| 368 |
// not only map from timezone to region code, but to look at |
| 369 |
// the continent and raw offsets for further clues to guide the |
| 370 |
// region choice.) |
| 371 |
if (relevant != null) { |
| 372 |
String region = getTimeZoneRegionAlpha2(TimeZone.getDefault()); |
| 373 |
if (region == null) { |
| 374 |
// Unknown timezone: ambiguous and don't attempt to guess |
| 375 |
return null; |
| 376 |
} |
| 377 |
if (regions.contains(region) && (relevant.isEmpty() || relevant.contains(region))) { |
| 378 |
return region; |
| 379 |
} |
| 380 |
} |
| 381 |
|
| 382 |
// |
| 383 |
// (6) Look at installed locales, and limit our options to the regions |
| 384 |
// found in locales for the given language. |
| 385 |
// For example, on my system, the LocaleManager provides 90 |
| 386 |
// relevant regions for English, but my system only has 11, |
| 387 |
// so we can eliminate the remaining 79 from consideration. |
| 388 |
// (Sadly, it doesn't look like the local locales are sorted |
| 389 |
// in any way significant for the user, so we can't just assume |
| 390 |
// that the first locale of the target language is somehow special.) |
| 391 |
Locale candidate = null; |
| 392 |
for (Locale available : Locale.getAvailableLocales()) { |
| 393 |
if (languageCode.equals(available.getLanguage()) && |
| 394 |
regions.contains(available.getCountry())) { |
| 395 |
if (candidate != null) { |
| 396 |
candidate = null; // more than one match; doesn't help us |
| 397 |
break; |
| 398 |
} else { |
| 399 |
candidate = available; |
| 400 |
} |
| 401 |
} |
| 402 |
} |
| 403 |
if (candidate != null && relevant != null && |
| 404 |
(relevant.isEmpty() || relevant.contains(candidate.getCountry()))) { |
| 405 |
return candidate.getCountry(); |
| 406 |
} |
| 407 |
|
| 408 |
// |
| 409 |
// (7) Consult the project to see which locales are used there. |
| 410 |
// If for example your project has resources in "en-rUS", it's |
| 411 |
// unlikely that you intend for "US" to be the region for en |
| 412 |
// (since that's a region specific overlay) so pick for example GB |
| 413 |
// instead. |
| 414 |
if (resources != null) { |
| 415 |
ListMultimap<String, com.android.ide.common.res2.ResourceItem> strings = resources |
| 416 |
.getItems().get(ResourceType.STRING); |
| 417 |
if (strings != null) { |
| 418 |
Set<String> specified = Sets.newHashSet(); |
| 419 |
for (com.android.ide.common.res2.ResourceItem item : strings.values()) { |
| 420 |
String qualifiers = item.getQualifiers(); |
| 421 |
if (qualifiers.startsWith(languageCode) && qualifiers.length() == 6 |
| 422 |
&& qualifiers.charAt(3) == 'r') { |
| 423 |
specified.add(qualifiers.substring(4)); |
| 424 |
} |
| 425 |
} |
| 426 |
if (!specified.isEmpty()) { |
| 427 |
// Remove the specified locales from consideration |
| 428 |
Set<String> all = Sets.newHashSet(regions); |
| 429 |
all.removeAll(specified); |
| 430 |
// Only one left? |
| 431 |
if (all.size() == 1) { |
| 432 |
return all.iterator().next(); |
| 433 |
} |
| 434 |
} |
| 435 |
} |
| 436 |
} |
| 437 |
|
| 438 |
// |
| 439 |
// (8) Give preference to a region that has the same region code |
| 440 |
// as the language code; this is usually where the language is named |
| 441 |
// after a region |
| 442 |
char first = Character.toUpperCase(languageCode.charAt(0)); |
| 443 |
char second = Character.toUpperCase(languageCode.charAt(1)); |
| 444 |
for (String r : regions) { |
| 445 |
if (r.charAt(0) == first && r.charAt(1) == second) { |
| 446 |
return r; |
| 447 |
} |
| 448 |
} |
| 449 |
} else if (regions.size() == 1) { |
| 450 |
return regions.get(0); |
| 451 |
} |
| 452 |
|
| 453 |
// Finally just pick the default one |
| 454 |
return getDefaultLanguageRegion(languageCode); |
| 455 |
} |
| 456 |
|
| 457 |
@Nullable |
| 458 |
private static List<String> getDisambiguateRegions(@NonNull String languageCode) { |
| 459 |
if ("ar".equals(languageCode) || "zh".equals(languageCode)) { |
| 460 |
return Collections.emptyList(); |
| 461 |
} else if ("en".equals(languageCode)) { |
| 462 |
return Arrays.asList("US", "GB"); |
| 463 |
} else if ("es".equals(languageCode)) { |
| 464 |
return Arrays.asList("MX", "AR", "CL", "CO", "CR", "CU", "DO", "GT", "HN", "NI", |
| 465 |
"PA", "PY", "SV", "UY", "VE", "ME"); |
| 466 |
} else if ("pt".equals(languageCode)) { |
| 467 |
return Arrays.asList("PT", "BR"); |
| 468 |
} else if ("ru".equals(languageCode)) { |
| 469 |
return Collections.singletonList("ru"); |
| 470 |
} else { |
| 471 |
return null; |
| 472 |
} |
| 473 |
} |
| 474 |
|
| 475 |
/** |
| 476 |
* Get the region code (either 3166-1 or if necessary, 3166-2) for the given |
| 477 |
* 3166-2 region code |
| 478 |
*/ |
| 479 |
private static String getRegionCode(int index) { |
| 480 |
if (index != -1) { |
| 481 |
int twoLetterIndex = ISO_3166_2_TO_1[index]; |
| 482 |
if (twoLetterIndex != -1) { |
| 483 |
return ISO_3166_1_CODES[twoLetterIndex]; |
| 484 |
} else { |
| 485 |
return ISO_3166_2_CODES[index]; |
| 486 |
} |
| 487 |
} |
| 488 |
|
| 489 |
return null; |
| 490 |
} |
| 491 |
|
| 492 |
/** Returns the relevant regions for the given language, if known. */ |
| 493 |
@NonNull |
| 494 |
public static List<String> getRelevantRegions(@NonNull String languageCode) { |
| 495 |
int languageIndex; |
| 496 |
if (languageCode.length() == 2) { |
| 497 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 498 |
&& Character.isLowerCase(languageCode.charAt(1)) : languageCode; |
| 499 |
int index = Arrays.binarySearch(ISO_639_1_CODES, languageCode); |
| 500 |
if (index < 0 || index >= ISO_639_1_TO_2.length) { |
| 501 |
return Collections.emptyList(); |
| 502 |
} |
| 503 |
languageIndex = ISO_639_1_TO_2[index]; |
| 504 |
} else if (languageCode.length() == 3) { |
| 505 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 506 |
&& Character.isLowerCase(languageCode.charAt(1)) |
| 507 |
&& Character.isLowerCase(languageCode.charAt(2)) : languageCode; |
| 508 |
languageIndex = Arrays.binarySearch(ISO_639_2_CODES, languageCode); |
| 509 |
if (languageIndex < 0) { |
| 510 |
return Collections.emptyList(); |
| 511 |
} |
| 512 |
} else { |
| 513 |
assert false : languageCode; |
| 514 |
return Collections.emptyList(); |
| 515 |
} |
| 516 |
|
| 517 |
int[] regionIndices = LANGUAGE_REGIONS[languageIndex]; |
| 518 |
if (regionIndices == null) { // only returns non-null when there are multiple |
| 519 |
String regionCode = getRegionCode(LANGUAGE_REGION[languageIndex]); |
| 520 |
return regionCode != null ? Collections.singletonList(regionCode) |
| 521 |
: Collections.<String>emptyList(); |
| 522 |
|
| 523 |
} |
| 524 |
|
| 525 |
List<String> result = Lists.newArrayListWithExpectedSize(regionIndices.length); |
| 526 |
for (int regionIndex : regionIndices) { |
| 527 |
String regionCode = getRegionCode(regionIndex); |
| 528 |
if (regionCode != null) { |
| 529 |
result.add(regionCode); |
| 530 |
} |
| 531 |
} |
| 532 |
return result; |
| 533 |
} |
| 534 |
|
| 535 |
/** |
| 536 |
* Returns the corresponding ISO 639 alpha-2 code given an alpha-3 code |
| 537 |
* |
| 538 |
* @param languageCode the ISO 639 alpha-3 code |
| 539 |
* @return the corresponding ISO 639 alpha-2 code, if any |
| 540 |
*/ |
| 541 |
@Nullable |
| 542 |
public static String getLanguageAlpha2(@NonNull String languageCode) { |
| 543 |
assert languageCode.length() == 3 : languageCode; |
| 544 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 545 |
&& Character.isLowerCase(languageCode.charAt(1)) |
| 546 |
&& Character.isLowerCase(languageCode.charAt(2)) : languageCode; |
| 547 |
int index = Arrays.binarySearch(ISO_639_2_CODES, languageCode); |
| 548 |
if (index < 0) { |
| 549 |
return null; |
| 550 |
} |
| 551 |
int alpha2 = ISO_639_2_TO_1[index]; |
| 552 |
if (alpha2 != -1) { |
| 553 |
return ISO_639_1_CODES[alpha2]; |
| 554 |
} |
| 555 |
return null; |
| 556 |
} |
| 557 |
|
| 558 |
/** |
| 559 |
* Returns the corresponding ISO 639 alpha-3 code given an alpha-2 code |
| 560 |
* |
| 561 |
* @param languageCode the ISO 639 alpha-2 code |
| 562 |
* @return the corresponding ISO 639 alpha-3 code, if any |
| 563 |
*/ |
| 564 |
@Nullable |
| 565 |
public static String getLanguageAlpha3(@NonNull String languageCode) { |
| 566 |
assert languageCode.length() == 2 : languageCode; |
| 567 |
assert Character.isLowerCase(languageCode.charAt(0)) |
| 568 |
&& Character.isLowerCase(languageCode.charAt(1)) : languageCode; |
| 569 |
int index = Arrays.binarySearch(ISO_639_1_CODES, languageCode); |
| 570 |
if (index < 0) { |
| 571 |
return null; |
| 572 |
} |
| 573 |
int alpha2 = ISO_639_1_TO_2[index]; |
| 574 |
if (alpha2 != -1) { |
| 575 |
return ISO_639_2_CODES[alpha2]; |
| 576 |
} |
| 577 |
return null; |
| 578 |
} |
| 579 |
|
| 580 |
/** |
| 581 |
* Returns the corresponding ISO 3166 alpha-2 code given an alpha-3 code |
| 582 |
* |
| 583 |
* @param regionCode the ISO 3166 alpha-3 code |
| 584 |
* @return the corresponding ISO 3166 alpha-2 code, if any |
| 585 |
*/ |
| 586 |
@Nullable |
| 587 |
public static String getRegionAlpha2(@NonNull String regionCode) { |
| 588 |
assert regionCode.length() == 3 : regionCode; |
| 589 |
assert Character.isUpperCase(regionCode.charAt(0)) |
| 590 |
&& Character.isUpperCase(regionCode.charAt(1)) |
| 591 |
&& Character.isUpperCase(regionCode.charAt(2)) : regionCode; |
| 592 |
int index = Arrays.binarySearch(ISO_3166_2_CODES, regionCode); |
| 593 |
if (index < 0) { |
| 594 |
return null; |
| 595 |
} |
| 596 |
int alpha2 = ISO_3166_2_TO_1[index]; |
| 597 |
if (alpha2 != -1) { |
| 598 |
return ISO_3166_1_CODES[alpha2]; |
| 599 |
} |
| 600 |
return null; |
| 601 |
} |
| 602 |
|
| 603 |
/** |
| 604 |
* Returns the corresponding ISO 3166 alpha-3 code given an alpha-2 code |
| 605 |
* |
| 606 |
* @param regionCode the ISO 3166 alpha-2 code |
| 607 |
* @return the corresponding ISO 3166 alpha-3 code, if any |
| 608 |
*/ |
| 609 |
@Nullable |
| 610 |
public static String getRegionAlpha3(@NonNull String regionCode) { |
| 611 |
assert regionCode.length() == 2 : regionCode; |
| 612 |
assert Character.isUpperCase(regionCode.charAt(0)) |
| 613 |
&& Character.isUpperCase(regionCode.charAt(1)) : regionCode; |
| 614 |
int index = Arrays.binarySearch(ISO_3166_1_CODES, regionCode); |
| 615 |
if (index < 0) { |
| 616 |
return null; |
| 617 |
} |
| 618 |
int alpha2 = ISO_3166_1_TO_2[index]; |
| 619 |
if (alpha2 != -1) { |
| 620 |
return ISO_3166_2_CODES[alpha2]; |
| 621 |
} |
| 622 |
return null; |
| 623 |
} |
| 624 |
|
| 625 |
/** |
| 626 |
* Guess the 3-letter region code containing the given time zone |
| 627 |
* |
| 628 |
* @param zone The timezone to look up |
| 629 |
* @return the corresponding 3 letter region code |
| 630 |
*/ |
| 631 |
@SuppressWarnings("SpellCheckingInspection") |
| 632 |
@Nullable |
| 633 |
@VisibleForTesting |
| 634 |
public static String getTimeZoneRegionAlpha3(@NonNull TimeZone zone) { |
| 635 |
int index = getTimeZoneRegionIndex(zone); |
| 636 |
if (index != -1) { |
| 637 |
return ISO_3166_2_CODES[index]; |
| 638 |
} |
| 639 |
|
| 640 |
return null; |
| 641 |
} |
| 642 |
|
| 643 |
/** |
| 644 |
* Guess the 2-letter region code containing the given time zone |
| 645 |
* |
| 646 |
* @param zone The timezone to look up |
| 647 |
* @return the corresponding 2 letter region code |
| 648 |
*/ |
| 649 |
@SuppressWarnings("SpellCheckingInspection") |
| 650 |
@Nullable |
| 651 |
@VisibleForTesting |
| 652 |
public static String getTimeZoneRegionAlpha2(@NonNull TimeZone zone) { |
| 653 |
int index = getTimeZoneRegionIndex(zone); |
| 654 |
if (index != -1) { |
| 655 |
index = ISO_3166_2_TO_1[index]; |
| 656 |
if (index != -1) { |
| 657 |
return ISO_3166_1_CODES[index]; |
| 658 |
} |
| 659 |
} |
| 660 |
|
| 661 |
return null; |
| 662 |
} |
| 663 |
|
| 664 |
// The remainder of this class is generated by generate-locale-data |
| 665 |
// DO NOT EDIT MANUALLY |
| 666 |
|
| 667 |
private static int getTimeZoneRegionIndex(@NonNull TimeZone zone) { |
| 668 |
// Instead of String#hashCode, use this to ensure stable across platforms |
| 669 |
String id = zone.getID(); |
| 670 |
int hashedId = 0; |
| 671 |
for (int i = 0, n = id.length(); i < n; i++) { |
| 672 |
hashedId = 31 * hashedId + id.charAt(i); |
| 673 |
} |
| 674 |
switch (zone.getRawOffset()) { |
| 675 |
case -36000000: |
| 676 |
return 234; |
| 677 |
case -32400000: |
| 678 |
return 234; |
| 679 |
case -28800000: |
| 680 |
switch (hashedId) { |
| 681 |
case -459287604: |
| 682 |
case 256046501: |
| 683 |
case 1647318035: |
| 684 |
case -1983011822: |
| 685 |
return 142; |
| 686 |
case 1389185817: |
| 687 |
case 900028252: |
| 688 |
case -347637707: |
| 689 |
case 364935240: |
| 690 |
case -2010814355: |
| 691 |
return 39; |
| 692 |
default: |
| 693 |
return 234; |
| 694 |
} |
| 695 |
case -25200000: |
| 696 |
switch (hashedId) { |
| 697 |
case 202222115: |
| 698 |
case 611591843: |
| 699 |
case 2142546433: |
| 700 |
case 1532263802: |
| 701 |
case -641163936: |
| 702 |
return 142; |
| 703 |
case -1774689070: |
| 704 |
case -302339179: |
| 705 |
case -1998145482: |
| 706 |
case -906910905: |
| 707 |
case 1544280457: |
| 708 |
case 1924477936: |
| 709 |
case 1850095790: |
| 710 |
return 39; |
| 711 |
default: |
| 712 |
return 234; |
| 713 |
} |
| 714 |
case -21600000: |
| 715 |
switch (hashedId) { |
| 716 |
case -355081471: |
| 717 |
return 52; |
| 718 |
case 662067781: |
| 719 |
return 65; |
| 720 |
case 268098540: |
| 721 |
return 92; |
| 722 |
case -1192934179: |
| 723 |
return 98; |
| 724 |
case -496169397: |
| 725 |
return 164; |
| 726 |
case -610612331: |
| 727 |
return 200; |
| 728 |
case 35870737: |
| 729 |
case -2089950224: |
| 730 |
return 42; |
| 731 |
case 1033313139: |
| 732 |
case 1360273357: |
| 733 |
case 958016402: |
| 734 |
case 1650383341: |
| 735 |
case -1436528620: |
| 736 |
case -905842704: |
| 737 |
case -380253810: |
| 738 |
return 142; |
| 739 |
case -1997850159: |
| 740 |
case 1290869225: |
| 741 |
case 1793201705: |
| 742 |
case 1334007082: |
| 743 |
case 99854508: |
| 744 |
case 569007676: |
| 745 |
case 1837303604: |
| 746 |
case -1616213428: |
| 747 |
case -1958461186: |
| 748 |
return 39; |
| 749 |
default: |
| 750 |
return 234; |
| 751 |
} |
| 752 |
case -18000000: |
| 753 |
switch (hashedId) { |
| 754 |
case 1344376451: |
| 755 |
return 49; |
| 756 |
case 407688513: |
| 757 |
return 65; |
| 758 |
case 1732450137: |
| 759 |
return 173; |
| 760 |
case 2039677810: |
| 761 |
return 175; |
| 762 |
case 1503655288: |
| 763 |
case 2111569: |
| 764 |
return 53; |
| 765 |
case -615687308: |
| 766 |
case 42696295: |
| 767 |
case -1756511823: |
| 768 |
case 1213658776: |
| 769 |
return 32; |
| 770 |
case 1908749375: |
| 771 |
case -1694184172: |
| 772 |
case 695184620: |
| 773 |
case 1356626855: |
| 774 |
case 622452689: |
| 775 |
case 977509670: |
| 776 |
case 151241566: |
| 777 |
case 1826315056: |
| 778 |
case -792567293: |
| 779 |
return 39; |
| 780 |
default: |
| 781 |
return 234; |
| 782 |
} |
| 783 |
case -16200000: |
| 784 |
return 238; |
| 785 |
case -14400000: |
| 786 |
switch (hashedId) { |
| 787 |
case 1501639611: |
| 788 |
return 8; |
| 789 |
case 1617469984: |
| 790 |
return 31; |
| 791 |
case -432820086: |
| 792 |
return 63; |
| 793 |
case 1367207089: |
| 794 |
return 183; |
| 795 |
case -611834443: |
| 796 |
case -2036395347: |
| 797 |
return 42; |
| 798 |
case -691236908: |
| 799 |
case 79506: |
| 800 |
return 180; |
| 801 |
case -1680637607: |
| 802 |
case 1275531960: |
| 803 |
case -2087755565: |
| 804 |
case -640330778: |
| 805 |
case -95289381: |
| 806 |
case -2011036567: |
| 807 |
return 39; |
| 808 |
default: |
| 809 |
return 32; |
| 810 |
} |
| 811 |
case -12600000: |
| 812 |
return 39; |
| 813 |
case -10800000: |
| 814 |
switch (hashedId) { |
| 815 |
case 1987071743: |
| 816 |
return 233; |
| 817 |
case 1231674648: |
| 818 |
case -1203975328: |
| 819 |
case -1203852432: |
| 820 |
case -615687308: |
| 821 |
case -1887400619: |
| 822 |
case 1646238717: |
| 823 |
case 42696295: |
| 824 |
case 1793082297: |
| 825 |
case -1756511823: |
| 826 |
case -612056498: |
| 827 |
case -1523781592: |
| 828 |
case 65649: |
| 829 |
case 1213658776: |
| 830 |
case 1213776064: |
| 831 |
return 32; |
| 832 |
default: |
| 833 |
return 8; |
| 834 |
} |
| 835 |
case -7200000: |
| 836 |
return 32; |
| 837 |
case -3600000: |
| 838 |
return 182; |
| 839 |
case 0: |
| 840 |
switch (hashedId) { |
| 841 |
case -2002672065: |
| 842 |
return 69; |
| 843 |
case -3562122: |
| 844 |
return 137; |
| 845 |
case 2160119: |
| 846 |
case 300259341: |
| 847 |
return 106; |
| 848 |
case -1722575083: |
| 849 |
case -1000832298: |
| 850 |
return 109; |
| 851 |
case -1677314468: |
| 852 |
case 518707320: |
| 853 |
case 794006110: |
| 854 |
return 182; |
| 855 |
default: |
| 856 |
return 79; |
| 857 |
} |
| 858 |
case 3600000: |
| 859 |
switch (hashedId) { |
| 860 |
case 747709736: |
| 861 |
return 5; |
| 862 |
case 804593244: |
| 863 |
return 15; |
| 864 |
case 1036497278: |
| 865 |
return 26; |
| 866 |
case -516035308: |
| 867 |
return 18; |
| 868 |
case 930574244: |
| 869 |
return 41; |
| 870 |
case 641004357: |
| 871 |
return 58; |
| 872 |
case -862787273: |
| 873 |
return 62; |
| 874 |
case -977866396: |
| 875 |
return 64; |
| 876 |
case 911784828: |
| 877 |
return 99; |
| 878 |
case 1643067635: |
| 879 |
return 101; |
| 880 |
case -1407095582: |
| 881 |
return 111; |
| 882 |
case 432607731: |
| 883 |
return 133; |
| 884 |
case -1834768363: |
| 885 |
return 148; |
| 886 |
case 720852545: |
| 887 |
return 144; |
| 888 |
case -675325160: |
| 889 |
return 146; |
| 890 |
case 1107183657: |
| 891 |
return 166; |
| 892 |
case 562540219: |
| 893 |
return 204; |
| 894 |
case -1783944015: |
| 895 |
return 210; |
| 896 |
case -1262503490: |
| 897 |
return 209; |
| 898 |
case -1871032358: |
| 899 |
return 208; |
| 900 |
case 1817919522: |
| 901 |
return 225; |
| 902 |
case 228701359: |
| 903 |
case 2079834968: |
| 904 |
return 59; |
| 905 |
case 1801750059: |
| 906 |
case 539516618: |
| 907 |
return 69; |
| 908 |
case 68470: |
| 909 |
case -672549154: |
| 910 |
return 75; |
| 911 |
case -1121325742: |
| 912 |
case 73413677: |
| 913 |
return 127; |
| 914 |
case -72083073: |
| 915 |
case -1407181132: |
| 916 |
return 167; |
| 917 |
default: |
| 918 |
return 179; |
| 919 |
} |
| 920 |
case 7200000: |
| 921 |
switch (hashedId) { |
| 922 |
case -669373067: |
| 923 |
return 23; |
| 924 |
case 1469914287: |
| 925 |
return 70; |
| 926 |
case -1854672812: |
| 927 |
return 72; |
| 928 |
case 213620546: |
| 929 |
return 89; |
| 930 |
case -1678352343: |
| 931 |
return 114; |
| 932 |
case -468176592: |
| 933 |
return 125; |
| 934 |
case -820952635: |
| 935 |
return 132; |
| 936 |
case -1407101538: |
| 937 |
return 134; |
| 938 |
case -1305089392: |
| 939 |
return 188; |
| 940 |
case 1640682817: |
| 941 |
return 189; |
| 942 |
case 1088211684: |
| 943 |
return 214; |
| 944 |
case 1587535273: |
| 945 |
return 246; |
| 946 |
case -2046172313: |
| 947 |
return -1; |
| 948 |
case 540421055: |
| 949 |
case 660679831: |
| 950 |
return 57; |
| 951 |
case -1121325742: |
| 952 |
case 73413677: |
| 953 |
return 127; |
| 954 |
case 65091: |
| 955 |
case 1801619315: |
| 956 |
case 66911291: |
| 957 |
return 66; |
| 958 |
case 511371267: |
| 959 |
case -1868494453: |
| 960 |
case -2095341728: |
| 961 |
return 110; |
| 962 |
case 207779975: |
| 963 |
case -359165265: |
| 964 |
case -1778564402: |
| 965 |
return 226; |
| 966 |
default: |
| 967 |
return 231; |
| 968 |
} |
| 969 |
case 10800000: |
| 970 |
switch (hashedId) { |
| 971 |
case -1744032040: |
| 972 |
return 24; |
| 973 |
case -675084931: |
| 974 |
return 28; |
| 975 |
case -1745250846: |
| 976 |
return 108; |
| 977 |
case -195337532: |
| 978 |
return 123; |
| 979 |
case -1663926768: |
| 980 |
return 186; |
| 981 |
case -5956312: |
| 982 |
return 191; |
| 983 |
case 581080470: |
| 984 |
return 192; |
| 985 |
case -1439622607: |
| 986 |
return 245; |
| 987 |
case -2046172313: |
| 988 |
return -1; |
| 989 |
default: |
| 990 |
return 189; |
| 991 |
} |
| 992 |
case 14400000: |
| 993 |
switch (hashedId) { |
| 994 |
case -1675354028: |
| 995 |
return 7; |
| 996 |
case -138196720: |
| 997 |
return 171; |
| 998 |
case -2046172313: |
| 999 |
return -1; |
| 1000 |
default: |
| 1001 |
return 189; |
| 1002 |
} |
| 1003 |
case 18000000: |
| 1004 |
return 189; |
| 1005 |
case 19800000: |
| 1006 |
return 104; |
| 1007 |
case 21600000: |
| 1008 |
switch (hashedId) { |
| 1009 |
case 1958400136: |
| 1010 |
case 88135602: |
| 1011 |
return 43; |
| 1012 |
default: |
| 1013 |
return 189; |
| 1014 |
} |
| 1015 |
case 25200000: |
| 1016 |
switch (hashedId) { |
| 1017 |
case -1738808822: |
| 1018 |
return 218; |
| 1019 |
case 1063310893: |
| 1020 |
case -788096746: |
| 1021 |
return 102; |
| 1022 |
case 1214715332: |
| 1023 |
case 14814128: |
| 1024 |
case 85303: |
| 1025 |
return 241; |
| 1026 |
default: |
| 1027 |
return 189; |
| 1028 |
} |
| 1029 |
case 28800000: |
| 1030 |
switch (hashedId) { |
| 1031 |
case -156810007: |
| 1032 |
return 176; |
| 1033 |
case 43451613: |
| 1034 |
return 228; |
| 1035 |
case 307946178: |
| 1036 |
case 1811257630: |
| 1037 |
return 14; |
| 1038 |
case 404568855: |
| 1039 |
case -390386883: |
| 1040 |
return 96; |
| 1041 |
case -463608032: |
| 1042 |
case -84259736: |
| 1043 |
return 102; |
| 1044 |
case -99068543: |
| 1045 |
case -1778758162: |
| 1046 |
return 157; |
| 1047 |
case 663100500: |
| 1048 |
case -808657565: |
| 1049 |
return 189; |
| 1050 |
case 133428255: |
| 1051 |
case 499614468: |
| 1052 |
return 194; |
| 1053 |
default: |
| 1054 |
return 43; |
| 1055 |
} |
| 1056 |
case 31500000: |
| 1057 |
return 14; |
| 1058 |
case 32400000: |
| 1059 |
switch (hashedId) { |
| 1060 |
case -996350568: |
| 1061 |
return 102; |
| 1062 |
case -1661964753: |
| 1063 |
case 81326: |
| 1064 |
return 122; |
| 1065 |
case -1660747039: |
| 1066 |
case 73771: |
| 1067 |
case 71341030: |
| 1068 |
return 115; |
| 1069 |
default: |
| 1070 |
return 189; |
| 1071 |
} |
| 1072 |
case 34200000: |
| 1073 |
return 14; |
| 1074 |
case 36000000: |
| 1075 |
switch (hashedId) { |
| 1076 |
case 1988570398: |
| 1077 |
case -572853474: |
| 1078 |
case 1409241312: |
| 1079 |
case -402306110: |
| 1080 |
case 1755599521: |
| 1081 |
case 1491561941: |
| 1082 |
return 189; |
| 1083 |
default: |
| 1084 |
return 14; |
| 1085 |
} |
| 1086 |
case 37800000: |
| 1087 |
return 14; |
| 1088 |
case 39600000: |
| 1089 |
switch (hashedId) { |
| 1090 |
case -1609966193: |
| 1091 |
return 14; |
| 1092 |
default: |
| 1093 |
return 189; |
| 1094 |
} |
| 1095 |
case 43200000: |
| 1096 |
switch (hashedId) { |
| 1097 |
case -488745714: |
| 1098 |
case -345416640: |
| 1099 |
case -572853474: |
| 1100 |
return 189; |
| 1101 |
default: |
| 1102 |
return 170; |
| 1103 |
} |
| 1104 |
case 45900000: |
| 1105 |
return 170; |
| 1106 |
} |
| 1107 |
return -1; |
| 1108 |
} |
| 1109 |
|
| 1110 |
private static final String[] ISO_639_2_CODES = new String[] { |
| 1111 |
"aar", "abk", "ace", "ach", "ada", "ady", "afa", "afh", "afr", |
| 1112 |
"agq", "ain", "aka", "akk", "ale", "alg", "alt", "amh", "ang", |
| 1113 |
"anp", "apa", "ara", "arc", "arg", "arn", "arp", "art", "arw", |
| 1114 |
"asa", "asm", "ast", "ath", "aus", "ava", "ave", "awa", "aym", |
| 1115 |
"aze", "bad", "bai", "bak", "bal", "bam", "ban", "bas", "bat", |
| 1116 |
"bej", "bel", "bem", "ben", "ber", "bez", "bho", "bih", "bik", |
| 1117 |
"bin", "bis", "bla", "bnt", "bod", "bos", "bra", "bre", "brx", |
| 1118 |
"btk", "bua", "bug", "bul", "byn", "cad", "cai", "car", "cat", |
| 1119 |
"cau", "ceb", "cel", "ces", "cgg", "cha", "chb", "che", "chg", |
| 1120 |
"chk", "chm", "chn", "cho", "chp", "chr", "chu", "chv", "chy", |
| 1121 |
"cmc", "cop", "cor", "cos", "cpe", "cpf", "cpp", "cre", "crh", |
| 1122 |
"crp", "csb", "cus", "cym", "dak", "dan", "dar", "dav", "day", |
| 1123 |
"del", "den", "deu", "dgr", "din", "div", "dje", "doi", "dra", |
| 1124 |
"dsb", "dua", "dum", "dyo", "dyu", "dzo", "ebu", "efi", "egy", |
| 1125 |
"eka", "ell", "elx", "eng", "enm", "epo", "est", "eus", "ewe", |
| 1126 |
"ewo", "fan", "fao", "fas", "fat", "fij", "fil", "fin", "fiu", |
| 1127 |
"fon", "fra", "frm", "fro", "frr", "frs", "fry", "ful", "fur", |
| 1128 |
"gaa", "gay", "gba", "gem", "gez", "gil", "gla", "gle", "glg", |
| 1129 |
"glv", "gmh", "goh", "gon", "gor", "got", "grb", "grc", "grn", |
| 1130 |
"gsw", "guj", "guz", "gwi", "hai", "hat", "hau", "haw", "heb", |
| 1131 |
"her", "hil", "him", "hin", "hit", "hmn", "hmo", "hrv", "hsb", |
| 1132 |
"hun", "hup", "hye", "iba", "ibo", "ido", "iii", "ijo", "iku", |
| 1133 |
"ile", "ilo", "ina", "inc", "ind", "ine", "inh", "ipk", "ira", |
| 1134 |
"iro", "isl", "ita", "jav", "jbo", "jgo", "jmc", "jpn", "jpr", |
| 1135 |
"jrb", "kaa", "kab", "kac", "kal", "kam", "kan", "kar", "kas", |
| 1136 |
"kat", "kau", "kaw", "kaz", "kbd", "kde", "kea", "kha", "khi", |
| 1137 |
"khm", "kho", "khq", "kik", "kin", "kir", "kkj", "kln", "kmb", |
| 1138 |
"kok", "kom", "kon", "kor", "kos", "kpe", "krc", "krl", "kro", |
| 1139 |
"kru", "ksb", "ksf", "ksh", "kua", "kum", "kur", "kut", "lad", |
| 1140 |
"lag", "lah", "lam", "lao", "lat", "lav", "lez", "lim", "lin", |
| 1141 |
"lit", "lkt", "lol", "loz", "ltz", "lua", "lub", "lug", "lui", |
| 1142 |
"lun", "luo", "lus", "luy", "mad", "mag", "mah", "mai", "mak", |
| 1143 |
"mal", "man", "mao", "map", "mar", "mas", "mdf", "mdr", "men", |
| 1144 |
"mer", "mfe", "mga", "mgh", "mgo", "mic", "min", "mis", "mkd", |
| 1145 |
"mkh", "mlg", "mlt", "mnc", "mni", "mno", "moh", "mon", "mos", |
| 1146 |
"msa", "mua", "mul", "mun", "mus", "mwl", "mwr", "mya", "myn", |
| 1147 |
"myv", "nah", "nai", "nap", "naq", "nau", "nav", "nbl", "nde", |
| 1148 |
"ndo", "nds", "nep", "new", "nia", "nic", "niu", "nld", "nmg", |
| 1149 |
"nnh", "nno", "nob", "nog", "non", "nor", "nqo", "nso", "nub", |
| 1150 |
"nus", "nwc", "nya", "nym", "nyn", "nyo", "nzi", "oci", "oji", |
| 1151 |
"ori", "orm", "osa", "oss", "ota", "oto", "paa", "pag", "pal", |
| 1152 |
"pam", "pan", "pap", "pau", "peo", "phi", "phn", "pli", "pol", |
| 1153 |
"pon", "por", "pra", "pro", "pus", "que", "raj", "rap", "rar", |
| 1154 |
"roa", "rof", "roh", "rom", "ron", "run", "rup", "rus", "rwk", |
| 1155 |
"sad", "sag", "sah", "sai", "sal", "sam", "san", "saq", "sas", |
| 1156 |
"sat", "sbp", "scn", "sco", "seh", "sel", "sem", "ses", "sga", |
| 1157 |
"sgn", "shi", "shn", "sid", "sin", "sio", "sit", "sla", "slk", |
| 1158 |
"slv", "sma", "sme", "smi", "smj", "smn", "smo", "sms", "sna", |
| 1159 |
"snd", "snk", "sog", "som", "son", "sot", "spa", "sqi", "srd", |
| 1160 |
"srn", "srp", "srr", "ssa", "ssw", "suk", "sun", "sus", "sux", |
| 1161 |
"swa", "swc", "swe", "syc", "syr", "tah", "tai", "tam", "tat", |
| 1162 |
"tel", "tem", "teo", "ter", "tet", "tgk", "tgl", "tha", "tig", |
| 1163 |
"tir", "tiv", "tkl", "tlh", "tli", "tmh", "tog", "ton", "tpi", |
| 1164 |
"tsi", "tsn", "tso", "tuk", "tum", "tup", "tur", "tut", "tvl", |
| 1165 |
"twi", "twq", "tyv", "tzm", "udm", "uga", "uig", "ukr", "umb", |
| 1166 |
"und", "urd", "uzb", "vai", "ven", "vie", "vol", "vot", "vun", |
| 1167 |
"wae", "wak", "wal", "war", "was", "wen", "wln", "wol", "xal", |
| 1168 |
"xho", "xog", "yao", "yap", "yav", "yid", "yor", "ypk", "zap", |
| 1169 |
"zbl", "zen", "zgh", "zha", "zho", "znd", "zul", "zun", "zza" |
| 1170 |
|
| 1171 |
}; |
| 1172 |
|
| 1173 |
private static final String[] ISO_639_2_NAMES = new String[] { |
| 1174 |
"Afar", // Code aar/aa |
| 1175 |
"Abkhazian", // Code abk/ab |
| 1176 |
"Achinese", // Code ace |
| 1177 |
"Acoli", // Code ach |
| 1178 |
"Adangme", // Code ada |
| 1179 |
"Adyghe; Adygei", // Code ady |
| 1180 |
"Afro-Asiatic languages", // Code afa |
| 1181 |
"Afrihili", // Code afh |
| 1182 |
"Afrikaans", // Code afr/af |
| 1183 |
"Aghem", // Code agq |
| 1184 |
"Ainu", // Code ain |
| 1185 |
"Akan", // Code aka/ak |
| 1186 |
"Akkadian", // Code akk |
| 1187 |
"Aleut", // Code ale |
| 1188 |
"Algonquian languages", // Code alg |
| 1189 |
"Southern Altai", // Code alt |
| 1190 |
"Amharic", // Code amh/am |
| 1191 |
"English, Old (ca.450-1100)", // Code ang |
| 1192 |
"Angika", // Code anp |
| 1193 |
"Apache languages", // Code apa |
| 1194 |
"Arabic", // Code ara/ar |
| 1195 |
"Official Aramaic (700-300 BCE); Imperial Aramaic (700-300 BCE)",// Code arc |
| 1196 |
"Aragonese", // Code arg/an |
| 1197 |
"Mapudungun; Mapuche", // Code arn |
| 1198 |
"Arapaho", // Code arp |
| 1199 |
"Artificial languages", // Code art |
| 1200 |
"Arawak", // Code arw |
| 1201 |
"Asu", // Code asa |
| 1202 |
"Assamese", // Code asm/as |
| 1203 |
"Asturian; Bable; Leonese; Asturleonese",// Code ast |
| 1204 |
"Athapascan languages", // Code ath |
| 1205 |
"Australian languages", // Code aus |
| 1206 |
"Avaric", // Code ava/av |
| 1207 |
"Avestan", // Code ave/ae |
| 1208 |
"Awadhi", // Code awa |
| 1209 |
"Aymara", // Code aym/ay |
| 1210 |
"Azerbaijani", // Code aze/az |
| 1211 |
"Banda languages", // Code bad |
| 1212 |
"Bamileke languages", // Code bai |
| 1213 |
"Bashkir", // Code bak/ba |
| 1214 |
"Baluchi", // Code bal |
| 1215 |
"Bambara", // Code bam/bm |
| 1216 |
"Balinese", // Code ban |
| 1217 |
"Basa", // Code bas |
| 1218 |
"Baltic languages", // Code bat |
| 1219 |
"Beja; Bedawiyet", // Code bej |
| 1220 |
"Belarusian", // Code bel/be |
| 1221 |
"Bemba", // Code bem |
| 1222 |
"Bengali", // Code ben/bn |
| 1223 |
"Berber languages", // Code ber |
| 1224 |
"Bena", // Code bez |
| 1225 |
"Bhojpuri", // Code bho |
| 1226 |
"Bihari languages", // Code bih/bh |
| 1227 |
"Bikol", // Code bik |
| 1228 |
"Bini; Edo", // Code bin |
| 1229 |
"Bislama", // Code bis/bi |
| 1230 |
"Siksika", // Code bla |
| 1231 |
"Bantu (Other)", // Code bnt |
| 1232 |
"Tibetan", // Code bod/bo |
| 1233 |
"Bosnian", // Code bos/bs |
| 1234 |
"Braj", // Code bra |
| 1235 |
"Breton", // Code bre/br |
| 1236 |
"Bodo", // Code brx |
| 1237 |
"Batak languages", // Code btk |
| 1238 |
"Buriat", // Code bua |
| 1239 |
"Buginese", // Code bug |
| 1240 |
"Bulgarian", // Code bul/bg |
| 1241 |
"Blin; Bilin", // Code byn |
| 1242 |
"Caddo", // Code cad |
| 1243 |
"Central American Indian languages", // Code cai |
| 1244 |
"Galibi Carib", // Code car |
| 1245 |
"Catalan", // Code cat/ca |
| 1246 |
"Caucasian languages", // Code cau |
| 1247 |
"Cebuano", // Code ceb |
| 1248 |
"Celtic languages", // Code cel |
| 1249 |
"Czech", // Code ces/cs |
| 1250 |
"Chiga", // Code cgg |
| 1251 |
"Chamorro", // Code cha/ch |
| 1252 |
"Chibcha", // Code chb |
| 1253 |
"Chechen", // Code che/ce |
| 1254 |
"Chagatai", // Code chg |
| 1255 |
"Chuukese", // Code chk |
| 1256 |
"Mari", // Code chm |
| 1257 |
"Chinook jargon", // Code chn |
| 1258 |
"Choctaw", // Code cho |
| 1259 |
"Chipewyan; Dene Suline", // Code chp |
| 1260 |
"Cherokee", // Code chr |
| 1261 |
"Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic",// Code chu/cu |
| 1262 |
"Chuvash", // Code chv/cv |
| 1263 |
"Cheyenne", // Code chy |
| 1264 |
"Chamic languages", // Code cmc |
| 1265 |
"Coptic", // Code cop |
| 1266 |
"Cornish", // Code cor/kw |
| 1267 |
"Corsican", // Code cos/co |
| 1268 |
"Creoles and pidgins, English based", // Code cpe |
| 1269 |
"Creoles and pidgins, French-based ", // Code cpf |
| 1270 |
"Creoles and pidgins, Portuguese-based ",// Code cpp |
| 1271 |
"Cree", // Code cre/cr |
| 1272 |
"Crimean Tatar; Crimean Turkish", // Code crh |
| 1273 |
"Creoles and pidgins ", // Code crp |
| 1274 |
"Kashubian", // Code csb |
| 1275 |
"Cushitic languages", // Code cus |
| 1276 |
"Welsh", // Code cym/cy |
| 1277 |
"Dakota", // Code dak |
| 1278 |
"Danish", // Code dan/da |
| 1279 |
"Dargwa", // Code dar |
| 1280 |
"Taita", // Code dav |
| 1281 |
"Land Dayak languages", // Code day |
| 1282 |
"Delaware", // Code del |
| 1283 |
"Slave (Athapascan)", // Code den |
| 1284 |
"German", // Code deu/de |
| 1285 |
"Dogrib", // Code dgr |
| 1286 |
"Dinka", // Code din |
| 1287 |
"Divehi; Dhivehi; Maldivian", // Code div/dv |
| 1288 |
"Zarma", // Code dje |
| 1289 |
"Dogri", // Code doi |
| 1290 |
"Dravidian languages", // Code dra |
| 1291 |
"Lower Sorbian", // Code dsb |
| 1292 |
"Duala", // Code dua |
| 1293 |
"Dutch, Middle (ca.1050-1350)", // Code dum |
| 1294 |
"Jola-Fonyi", // Code dyo |
| 1295 |
"Dyula", // Code dyu |
| 1296 |
"Dzongkha", // Code dzo/dz |
| 1297 |
"Embu", // Code ebu |
| 1298 |
"Efik", // Code efi |
| 1299 |
"Egyptian (Ancient)", // Code egy |
| 1300 |
"Ekajuk", // Code eka |
| 1301 |
"Greek", // Code ell/el |
| 1302 |
"Elamite", // Code elx |
| 1303 |
"English", // Code eng/en |
| 1304 |
"English, Middle (1100-1500)", // Code enm |
| 1305 |
"Esperanto", // Code epo/eo |
| 1306 |
"Estonian", // Code est/et |
| 1307 |
"Basque", // Code eus/eu |
| 1308 |
"Ewe", // Code ewe/ee |
| 1309 |
"Ewondo", // Code ewo |
| 1310 |
"Fang", // Code fan |
| 1311 |
"Faroese", // Code fao/fo |
| 1312 |
"Persian", // Code fas/fa |
| 1313 |
"Fanti", // Code fat |
| 1314 |
"Fijian", // Code fij/fj |
| 1315 |
"Filipino; Pilipino", // Code fil |
| 1316 |
"Finnish", // Code fin/fi |
| 1317 |
"Finno-Ugrian languages", // Code fiu |
| 1318 |
"Fon", // Code fon |
| 1319 |
"French", // Code fra/fr |
| 1320 |
"French, Middle (ca.1400-1600)", // Code frm |
| 1321 |
"French, Old (842-ca.1400)", // Code fro |
| 1322 |
"Northern Frisian", // Code frr |
| 1323 |
"Eastern Frisian", // Code frs |
| 1324 |
"Western Frisian", // Code fry/fy |
| 1325 |
"Fulah", // Code ful/ff |
| 1326 |
"Friulian", // Code fur |
| 1327 |
"Ga", // Code gaa |
| 1328 |
"Gayo", // Code gay |
| 1329 |
"Gbaya", // Code gba |
| 1330 |
"Germanic languages", // Code gem |
| 1331 |
"Geez", // Code gez |
| 1332 |
"Gilbertese", // Code gil |
| 1333 |
"Scottish Gaelic", // Code gla/gd |
| 1334 |
"Irish", // Code gle/ga |
| 1335 |
"Galician", // Code glg/gl |
| 1336 |
"Manx", // Code glv/gv |
| 1337 |
"German, Middle High (ca.1050-1500)", // Code gmh |
| 1338 |
"German, Old High (ca.750-1050)", // Code goh |
| 1339 |
"Gondi", // Code gon |
| 1340 |
"Gorontalo", // Code gor |
| 1341 |
"Gothic", // Code got |
| 1342 |
"Grebo", // Code grb |
| 1343 |
"Greek, Ancient (to 1453)", // Code grc |
| 1344 |
"Guarani", // Code grn/gn |
| 1345 |
"Swiss German; Alemannic; Alsatian", // Code gsw |
| 1346 |
"Gujarati", // Code guj/gu |
| 1347 |
"Gusii", // Code guz |
| 1348 |
"Gwich'in", // Code gwi |
| 1349 |
"Haida", // Code hai |
| 1350 |
"Haitian; Haitian Creole", // Code hat/ht |
| 1351 |
"Hausa", // Code hau/ha |
| 1352 |
"Hawaiian", // Code haw |
| 1353 |
"Hebrew", // Code heb/iw |
| 1354 |
"Herero", // Code her/hz |
| 1355 |
"Hiligaynon", // Code hil |
| 1356 |
"Himachali languages; Western Pahari languages",// Code him |
| 1357 |
"Hindi", // Code hin/hi |
| 1358 |
"Hittite", // Code hit |
| 1359 |
"Hmong; Mong", // Code hmn |
| 1360 |
"Hiri Motu", // Code hmo/ho |
| 1361 |
"Croatian", // Code hrv/hr |
| 1362 |
"Upper Sorbian", // Code hsb |
| 1363 |
"Hungarian", // Code hun/hu |
| 1364 |
"Hupa", // Code hup |
| 1365 |
"Armenian", // Code hye/hy |
| 1366 |
"Iban", // Code iba |
| 1367 |
"Igbo", // Code ibo/ig |
| 1368 |
"Ido", // Code ido/io |
| 1369 |
"Sichuan Yi", // Code iii/ii |
| 1370 |
"Ijo languages", // Code ijo |
| 1371 |
"Inuktitut", // Code iku/iu |
| 1372 |
"Interlingue; Occidental", // Code ile/ie |
| 1373 |
"Iloko", // Code ilo |
| 1374 |
"Interlingua (International Auxiliary Language Association)",// Code ina/ia |
| 1375 |
"Indic languages", // Code inc |
| 1376 |
"Indonesian", // Code ind/in |
| 1377 |
"Indo-European languages", // Code ine |
| 1378 |
"Ingush", // Code inh |
| 1379 |
"Inupiaq", // Code ipk/ik |
| 1380 |
"Iranian languages", // Code ira |
| 1381 |
"Iroquoian languages", // Code iro |
| 1382 |
"Icelandic", // Code isl/is |
| 1383 |
"Italian", // Code ita/it |
| 1384 |
"Javanese", // Code jav/jv |
| 1385 |
"Lojban", // Code jbo |
| 1386 |
"Ngomba", // Code jgo |
| 1387 |
"Machame", // Code jmc |
| 1388 |
"Japanese", // Code jpn/ja |
| 1389 |
"Judeo-Persian", // Code jpr |
| 1390 |
"Judeo-Arabic", // Code jrb |
| 1391 |
"Kara-Kalpak", // Code kaa |
| 1392 |
"Kabyle", // Code kab |
| 1393 |
"Kachin; Jingpho", // Code kac |
| 1394 |
"Kalaallisut", // Code kal/kl |
| 1395 |
"Kamba", // Code kam |
| 1396 |
"Kannada", // Code kan/kn |
| 1397 |
"Karen languages", // Code kar |
| 1398 |
"Kashmiri", // Code kas/ks |
| 1399 |
"Georgian", // Code kat/ka |
| 1400 |
"Kanuri", // Code kau/kr |
| 1401 |
"Kawi", // Code kaw |
| 1402 |
"Kazakh", // Code kaz/kk |
| 1403 |
"Kabardian", // Code kbd |
| 1404 |
"Makonde", // Code kde |
| 1405 |
"Kabuverdianu", // Code kea |
| 1406 |
"Khasi", // Code kha |
| 1407 |
"Khoisan languages", // Code khi |
| 1408 |
"Khmer", // Code khm/km |
| 1409 |
"Khotanese; Sakan", // Code kho |
| 1410 |
"Koyra Chiini", // Code khq |
| 1411 |
"Kikuyu", // Code kik/ki |
| 1412 |
"Kinyarwanda", // Code kin/rw |
| 1413 |
"Kyrgyz", // Code kir/ky |
| 1414 |
"Kako", // Code kkj |
| 1415 |
"Kalenjin", // Code kln |
| 1416 |
"Kimbundu", // Code kmb |
| 1417 |
"Konkani", // Code kok |
| 1418 |
"Komi", // Code kom/kv |
| 1419 |
"Kongo", // Code kon/kg |
| 1420 |
"Korean", // Code kor/ko |
| 1421 |
"Kosraean", // Code kos |
| 1422 |
"Kpelle", // Code kpe |
| 1423 |
"Karachay-Balkar", // Code krc |
| 1424 |
"Karelian", // Code krl |
| 1425 |
"Kru languages", // Code kro |
| 1426 |
"Kurukh", // Code kru |
| 1427 |
"Shambala", // Code ksb |
| 1428 |
"Bafia", // Code ksf |
| 1429 |
"Colognian", // Code ksh |
| 1430 |
"Kuanyama; Kwanyama", // Code kua/kj |
| 1431 |
"Kumyk", // Code kum |
| 1432 |
"Kurdish", // Code kur/ku |
| 1433 |
"Kutenai", // Code kut |
| 1434 |
"Ladino", // Code lad |
| 1435 |
"Langi", // Code lag |
| 1436 |
"Lahnda", // Code lah |
| 1437 |
"Lamba", // Code lam |
| 1438 |
"Lao", // Code lao/lo |
| 1439 |
"Latin", // Code lat/la |
| 1440 |
"Latvian", // Code lav/lv |
| 1441 |
"Lezghian", // Code lez |
| 1442 |
"Limburgan; Limburger; Limburgish", // Code lim/li |
| 1443 |
"Lingala", // Code lin/ln |
| 1444 |
"Lithuanian", // Code lit/lt |
| 1445 |
"Lakota", // Code lkt |
| 1446 |
"Mongo", // Code lol |
| 1447 |
"Lozi", // Code loz |
| 1448 |
"Luxembourgish", // Code ltz/lb |
| 1449 |
"Luba-Lulua", // Code lua |
| 1450 |
"Luba-Katanga", // Code lub/lu |
| 1451 |
"Ganda", // Code lug/lg |
| 1452 |
"Luiseno", // Code lui |
| 1453 |
"Lunda", // Code lun |
| 1454 |
"Luo (Kenya and Tanzania)", // Code luo |
| 1455 |
"Lushai", // Code lus |
| 1456 |
"Luyia", // Code luy |
| 1457 |
"Madurese", // Code mad |
| 1458 |
"Magahi", // Code mag |
| 1459 |
"Marshallese", // Code mah/mh |
| 1460 |
"Maithili", // Code mai |
| 1461 |
"Makasar", // Code mak |
| 1462 |
"Malayalam", // Code mal/ml |
| 1463 |
"Mandingo", // Code man |
| 1464 |
"Maori", // Code mao/mi |
| 1465 |
"Austronesian languages", // Code map |
| 1466 |
"Marathi", // Code mar/mr |
| 1467 |
"Masai", // Code mas |
| 1468 |
"Moksha", // Code mdf |
| 1469 |
"Mandar", // Code mdr |
| 1470 |
"Mende", // Code men |
| 1471 |
"Meru", // Code mer |
| 1472 |
"Morisyen", // Code mfe |
| 1473 |
"Irish, Middle (900-1200)", // Code mga |
| 1474 |
"Makhuwa-Meetto", // Code mgh |
| 1475 |
"Meta\u02bc", // Code mgo |
| 1476 |
"Mi'kmaq; Micmac", // Code mic |
| 1477 |
"Minangkabau", // Code min |
| 1478 |
"Uncoded languages", // Code mis |
| 1479 |
"Macedonian", // Code mkd/mk |
| 1480 |
"Mon-Khmer languages", // Code mkh |
| 1481 |
"Malagasy", // Code mlg/mg |
| 1482 |
"Maltese", // Code mlt/mt |
| 1483 |
"Manchu", // Code mnc |
| 1484 |
"Manipuri", // Code mni |
| 1485 |
"Manobo languages", // Code mno |
| 1486 |
"Mohawk", // Code moh |
| 1487 |
"Mongolian", // Code mon/mn |
| 1488 |
"Mossi", // Code mos |
| 1489 |
"Malay", // Code msa/ms |
| 1490 |
"Mundang", // Code mua |
| 1491 |
"Multiple languages", // Code mul |
| 1492 |
"Munda languages", // Code mun |
| 1493 |
"Creek", // Code mus |
| 1494 |
"Mirandese", // Code mwl |
| 1495 |
"Marwari", // Code mwr |
| 1496 |
"Burmese", // Code mya/my |
| 1497 |
"Mayan languages", // Code myn |
| 1498 |
"Erzya", // Code myv |
| 1499 |
"Nahuatl languages", // Code nah |
| 1500 |
"North American Indian languages", // Code nai |
| 1501 |
"Neapolitan", // Code nap |
| 1502 |
"Nama", // Code naq |
| 1503 |
"Nauru", // Code nau/na |
| 1504 |
"Navajo; Navaho", // Code nav/nv |
| 1505 |
"Ndebele, South; South Ndebele", // Code nbl/nr |
| 1506 |
"North Ndebele", // Code nde/nd |
| 1507 |
"Ndonga", // Code ndo/ng |
| 1508 |
"Low German; Low Saxon; German, Low; Saxon, Low",// Code nds |
| 1509 |
"Nepali", // Code nep/ne |
| 1510 |
"Nepal Bhasa; Newari", // Code new |
| 1511 |
"Nias", // Code nia |
| 1512 |
"Niger-Kordofanian languages", // Code nic |
| 1513 |
"Niuean", // Code niu |
| 1514 |
"Dutch", // Code nld/nl |
| 1515 |
"Kwasio", // Code nmg |
| 1516 |
"Ngiemboon", // Code nnh |
| 1517 |
"Norwegian Nynorsk", // Code nno/nn |
| 1518 |
"Norwegian Bokm\u00e5l", // Code nob/nb |
| 1519 |
"Nogai", // Code nog |
| 1520 |
"Norse, Old", // Code non |
| 1521 |
"Norwegian", // Code nor/no |
| 1522 |
"N'Ko", // Code nqo |
| 1523 |
"Pedi; Sepedi; Northern Sotho", // Code nso |
| 1524 |
"Nubian languages", // Code nub |
| 1525 |
"Nuer", // Code nus |
| 1526 |
"Classical Newari; Old Newari; Classical Nepal Bhasa",// Code nwc |
| 1527 |
"Chichewa; Chewa; Nyanja", // Code nya/ny |
| 1528 |
"Nyamwezi", // Code nym |
| 1529 |
"Nyankole", // Code nyn |
| 1530 |
"Nyoro", // Code nyo |
| 1531 |
"Nzima", // Code nzi |
| 1532 |
"Occitan (post 1500); Proven\u00e7al", // Code oci/oc |
| 1533 |
"Ojibwa", // Code oji/oj |
| 1534 |
"Oriya", // Code ori/or |
| 1535 |
"Oromo", // Code orm/om |
| 1536 |
"Osage", // Code osa |
| 1537 |
"Ossetic", // Code oss/os |
| 1538 |
"Turkish, Ottoman (1500-1928)", // Code ota |
| 1539 |
"Otomian languages", // Code oto |
| 1540 |
"Papuan languages", // Code paa |
| 1541 |
"Pangasinan", // Code pag |
| 1542 |
"Pahlavi", // Code pal |
| 1543 |
"Pampanga; Kapampangan", // Code pam |
| 1544 |
"Punjabi", // Code pan/pa |
| 1545 |
"Papiamento", // Code pap |
| 1546 |
"Palauan", // Code pau |
| 1547 |
"Persian, Old (ca.600-400 B.C.)", // Code peo |
| 1548 |
"Philippine languages", // Code phi |
| 1549 |
"Phoenician", // Code phn |
| 1550 |
"Pali", // Code pli/pi |
| 1551 |
"Polish", // Code pol/pl |
| 1552 |
"Pohnpeian", // Code pon |
| 1553 |
"Portuguese", // Code por/pt |
| 1554 |
"Prakrit languages", // Code pra |
| 1555 |
"Proven\u00e7al, Old (to 1500)", // Code pro |
| 1556 |
"Pashto", // Code pus/ps |
| 1557 |
"Quechua", // Code que/qu |
| 1558 |
"Rajasthani", // Code raj |
| 1559 |
"Rapanui", // Code rap |
| 1560 |
"Rarotongan; Cook Islands Maori", // Code rar |
| 1561 |
"Romance languages", // Code roa |
| 1562 |
"Rombo", // Code rof |
| 1563 |
"Romansh", // Code roh/rm |
| 1564 |
"Romany", // Code rom |
| 1565 |
"Romanian", // Code ron/ro |
| 1566 |
"Rundi", // Code run/rn |
| 1567 |
"Aromanian; Arumanian; Macedo-Romanian",// Code rup |
| 1568 |
"Russian", // Code rus/ru |
| 1569 |
"Rwa", // Code rwk |
| 1570 |
"Sandawe", // Code sad |
| 1571 |
"Sango", // Code sag/sg |
| 1572 |
"Yakut", // Code sah |
| 1573 |
"South American Indian (Other)", // Code sai |
| 1574 |
"Salishan languages", // Code sal |
| 1575 |
"Samaritan Aramaic", // Code sam |
| 1576 |
"Sanskrit", // Code san/sa |
| 1577 |
"Samburu", // Code saq |
| 1578 |
"Sasak", // Code sas |
| 1579 |
"Santali", // Code sat |
| 1580 |
"Sangu", // Code sbp |
| 1581 |
"Sicilian", // Code scn |
| 1582 |
"Scots", // Code sco |
| 1583 |
"Sena", // Code seh |
| 1584 |
"Selkup", // Code sel |
| 1585 |
"Semitic languages", // Code sem |
| 1586 |
"Koyraboro Senni", // Code ses |
| 1587 |
"Irish, Old (to 900)", // Code sga |
| 1588 |
"Sign Languages", // Code sgn |
| 1589 |
"Tachelhit", // Code shi |
| 1590 |
"Shan", // Code shn |
| 1591 |
"Sidamo", // Code sid |
| 1592 |
"Sinhala", // Code sin/si |
| 1593 |
"Siouan languages", // Code sio |
| 1594 |
"Sino-Tibetan languages", // Code sit |
| 1595 |
"Slavic languages", // Code sla |
| 1596 |
"Slovak", // Code slk/sk |
| 1597 |
"Slovenian", // Code slv/sl |
| 1598 |
"Southern Sami", // Code sma |
| 1599 |
"Northern Sami", // Code sme/se |
| 1600 |
"Sami languages", // Code smi |
| 1601 |
"Lule Sami", // Code smj |
| 1602 |
"Inari Sami", // Code smn |
| 1603 |
"Samoan", // Code smo/sm |
| 1604 |
"Skolt Sami", // Code sms |
| 1605 |
"Shona", // Code sna/sn |
| 1606 |
"Sindhi", // Code snd/sd |
| 1607 |
"Soninke", // Code snk |
| 1608 |
"Sogdian", // Code sog |
| 1609 |
"Somali", // Code som/so |
| 1610 |
"Songhai languages", // Code son |
| 1611 |
"Sotho, Southern", // Code sot/st |
| 1612 |
"Spanish", // Code spa/es |
| 1613 |
"Albanian", // Code sqi/sq |
| 1614 |
"Sardinian", // Code srd/sc |
| 1615 |
"Sranan Tongo", // Code srn |
| 1616 |
"Serbian", // Code srp/sr |
| 1617 |
"Serer", // Code srr |
| 1618 |
"Nilo-Saharan languages", // Code ssa |
| 1619 |
"Swati", // Code ssw/ss |
| 1620 |
"Sukuma", // Code suk |
| 1621 |
"Sundanese", // Code sun/su |
| 1622 |
"Susu", // Code sus |
| 1623 |
"Sumerian", // Code sux |
| 1624 |
"Swahili", // Code swa/sw |
| 1625 |
"Congo Swahili", // Code swc |
| 1626 |
"Swedish", // Code swe/sv |
| 1627 |
"Classical Syriac", // Code syc |
| 1628 |
"Syriac", // Code syr |
| 1629 |
"Tahitian", // Code tah/ty |
| 1630 |
"Tai languages", // Code tai |
| 1631 |
"Tamil", // Code tam/ta |
| 1632 |
"Tatar", // Code tat/tt |
| 1633 |
"Telugu", // Code tel/te |
| 1634 |
"Timne", // Code tem |
| 1635 |
"Teso", // Code teo |
| 1636 |
"Tereno", // Code ter |
| 1637 |
"Tetum", // Code tet |
| 1638 |
"Tajik", // Code tgk/tg |
| 1639 |
"Tagalog", // Code tgl/tl |
| 1640 |
"Thai", // Code tha/th |
| 1641 |
"Tigre", // Code tig |
| 1642 |
"Tigrinya", // Code tir/ti |
| 1643 |
"Tiv", // Code tiv |
| 1644 |
"Tokelau", // Code tkl |
| 1645 |
"Klingon; tlhIngan-Hol", // Code tlh |
| 1646 |
"Tlingit", // Code tli |
| 1647 |
"Tamashek", // Code tmh |
| 1648 |
"Tonga (Nyasa)", // Code tog |
| 1649 |
"Tongan", // Code ton/to |
| 1650 |
"Tok Pisin", // Code tpi |
| 1651 |
"Tsimshian", // Code tsi |
| 1652 |
"Tswana", // Code tsn/tn |
| 1653 |
"Tsonga", // Code tso/ts |
| 1654 |
"Turkmen", // Code tuk/tk |
| 1655 |
"Tumbuka", // Code tum |
| 1656 |
"Tupi languages", // Code tup |
| 1657 |
"Turkish", // Code tur/tr |
| 1658 |
"Altaic languages", // Code tut |
| 1659 |
"Tuvalu", // Code tvl |
| 1660 |
"Twi", // Code twi/tw |
| 1661 |
"Tasawaq", // Code twq |
| 1662 |
"Tuvinian", // Code tyv |
| 1663 |
"Central Atlas Tamazight", // Code tzm |
| 1664 |
"Udmurt", // Code udm |
| 1665 |
"Ugaritic", // Code uga |
| 1666 |
"Uyghur", // Code uig/ug |
| 1667 |
"Ukrainian", // Code ukr/uk |
| 1668 |
"Umbundu", // Code umb |
| 1669 |
"Undetermined", // Code und |
| 1670 |
"Urdu", // Code urd/ur |
| 1671 |
"Uzbek", // Code uzb/uz |
| 1672 |
"Vai", // Code vai |
| 1673 |
"Venda", // Code ven/ve |
| 1674 |
"Vietnamese", // Code vie/vi |
| 1675 |
"Volap\u00fck", // Code vol/vo |
| 1676 |
"Votic", // Code vot |
| 1677 |
"Vunjo", // Code vun |
| 1678 |
"Walser", // Code wae |
| 1679 |
"Wakashan languages", // Code wak |
| 1680 |
"Walamo", // Code wal |
| 1681 |
"Waray", // Code war |
| 1682 |
"Washo", // Code was |
| 1683 |
"Sorbian languages", // Code wen |
| 1684 |
"Walloon", // Code wln/wa |
| 1685 |
"Wolof", // Code wol/wo |
| 1686 |
"Kalmyk; Oirat", // Code xal |
| 1687 |
"Xhosa", // Code xho/xh |
| 1688 |
"Soga", // Code xog |
| 1689 |
"Yao", // Code yao |
| 1690 |
"Yapese", // Code yap |
| 1691 |
"Yangben", // Code yav |
| 1692 |
"Yiddish", // Code yid/ji |
| 1693 |
"Yoruba", // Code yor/yo |
| 1694 |
"Yupik languages", // Code ypk |
| 1695 |
"Zapotec", // Code zap |
| 1696 |
"Blissymbols; Blissymbolics; Bliss", // Code zbl |
| 1697 |
"Zenaga", // Code zen |
| 1698 |
"Standard Moroccan Tamazight", // Code zgh |
| 1699 |
"Zhuang; Chuang", // Code zha/za |
| 1700 |
"Chinese", // Code zho/zh |
| 1701 |
"Zande languages", // Code znd |
| 1702 |
"Zulu", // Code zul/zu |
| 1703 |
"Zuni", // Code zun |
| 1704 |
"Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki"// Code zza |
| 1705 |
}; |
| 1706 |
|
| 1707 |
private static final String[] ISO_639_1_CODES = new String[] { |
| 1708 |
"aa", "ab", "ae", "af", "ak", "am", "an", "ar", "as", "av", "ay", |
| 1709 |
"az", "ba", "be", "bg", "bh", "bi", "bm", "bn", "bo", "br", "bs", |
| 1710 |
"ca", "ce", "ch", "co", "cr", "cs", "cu", "cv", "cy", "da", "de", |
| 1711 |
"dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", |
| 1712 |
"fi", "fj", "fo", "fr", "fy", "ga", "gd", "gl", "gn", "gu", "gv", |
| 1713 |
"ha", "he", "hi", "ho", "hr", "ht", "hu", "hy", "hz", "ia", "id", |
| 1714 |
"ie", "ig", "ii", "ik", "in", "io", "is", "it", "iu", "iw", "ja", |
| 1715 |
"ji", "jv", "ka", "kg", "ki", "kj", "kk", "kl", "km", "kn", "ko", |
| 1716 |
"kr", "ks", "ku", "kv", "kw", "ky", "la", "lb", "lg", "li", "ln", |
| 1717 |
"lo", "lt", "lu", "lv", "mg", "mh", "mi", "mk", "ml", "mn", "mr", |
| 1718 |
"ms", "mt", "my", "na", "nb", "nd", "ne", "ng", "nl", "nn", "no", |
| 1719 |
"nr", "nv", "ny", "oc", "oj", "om", "or", "os", "pa", "pi", "pl", |
| 1720 |
"ps", "pt", "qu", "rm", "rn", "ro", "ru", "rw", "sa", "sc", "sd", |
| 1721 |
"se", "sg", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "ss", |
| 1722 |
"st", "su", "sv", "sw", "ta", "te", "tg", "th", "ti", "tk", "tl", |
| 1723 |
"tn", "to", "tr", "ts", "tt", "tw", "ty", "ug", "uk", "ur", "uz", |
| 1724 |
"ve", "vi", "vo", "wa", "wo", "xh", "yi", "yo", "za", "zh", "zu" |
| 1725 |
|
| 1726 |
}; |
| 1727 |
|
| 1728 |
// Each element corresponds to an ISO 639-1 code, and contains the index |
| 1729 |
// for the corresponding ISO 639-2 code |
| 1730 |
private static final int[] ISO_639_1_TO_2 = new int[] { |
| 1731 |
0, 1, 33, 8, 11, 16, 22, 20, 28, 32, 35, |
| 1732 |
36, 39, 46, 66, 52, 55, 41, 48, 58, 61, 59, |
| 1733 |
71, 79, 77, 93, 97, 75, 87, 88, 102, 104, 110, |
| 1734 |
113, 122, 134, 127, 129, 131, 438, 132, 133, 138, 151, |
| 1735 |
142, 140, 137, 145, 150, 160, 159, 161, 170, 172, 162, |
| 1736 |
177, 179, 183, 186, 187, 176, 189, 191, 180, 200, 202, |
| 1737 |
198, 193, 195, 205, 202, 194, 208, 209, 197, 179, 214, |
| 1738 |
518, 210, 225, 245, 237, 256, 228, 220, 234, 222, 246, |
| 1739 |
226, 224, 258, 244, 92, 239, 265, 274, 277, 268, 269, |
| 1740 |
264, 270, 276, 266, 307, 285, 290, 305, 288, 313, 292, |
| 1741 |
315, 308, 322, 329, 344, 332, 335, 333, 340, 343, 347, |
| 1742 |
331, 330, 353, 358, 359, 361, 360, 363, 370, 376, 377, |
| 1743 |
382, 379, 383, 389, 392, 391, 394, 238, 402, 440, 432, |
| 1744 |
425, 397, 418, 422, 423, 429, 431, 435, 439, 442, 445, |
| 1745 |
437, 447, 452, 450, 457, 459, 464, 466, 468, 480, 465, |
| 1746 |
478, 475, 483, 479, 458, 486, 455, 492, 493, 496, 497, |
| 1747 |
499, 500, 501, 510, 511, 513, 518, 519, 525, 526, 528 |
| 1748 |
|
| 1749 |
}; |
| 1750 |
|
| 1751 |
// Each element corresponds to an ISO 639-2 code, and contains the index |
| 1752 |
// for the corresponding ISO 639-1 code, or -1 if not represented |
| 1753 |
private static final int[] ISO_639_2_TO_1 = new int[] { |
| 1754 |
0, 1, -1, -1, -1, -1, -1, -1, 3, -1, -1, |
| 1755 |
4, -1, -1, -1, -1, 5, -1, -1, -1, 7, -1, |
| 1756 |
6, -1, -1, -1, -1, -1, 8, -1, -1, -1, 9, |
| 1757 |
2, -1, 10, 11, -1, -1, 12, -1, 17, -1, -1, |
| 1758 |
-1, -1, 13, -1, 18, -1, -1, -1, 15, -1, -1, |
| 1759 |
16, -1, -1, 19, 21, -1, 20, -1, -1, -1, -1, |
| 1760 |
14, -1, -1, -1, -1, 22, -1, -1, -1, 27, -1, |
| 1761 |
24, -1, 23, -1, -1, -1, -1, -1, -1, -1, 28, |
| 1762 |
29, -1, -1, -1, 92, 25, -1, -1, -1, 26, -1, |
| 1763 |
-1, -1, -1, 30, -1, 31, -1, -1, -1, -1, -1, |
| 1764 |
32, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, |
| 1765 |
-1, 34, -1, -1, -1, -1, 36, -1, 37, -1, 38, |
| 1766 |
40, 41, 35, -1, -1, 46, 42, -1, 45, -1, 44, |
| 1767 |
-1, -1, 47, -1, -1, -1, -1, 48, 43, -1, -1, |
| 1768 |
-1, -1, -1, -1, -1, 50, 49, 51, 54, -1, -1, |
| 1769 |
-1, -1, -1, -1, -1, 52, -1, 53, -1, -1, -1, |
| 1770 |
60, 55, -1, 75, 63, -1, -1, 57, -1, -1, 58, |
| 1771 |
59, -1, 61, -1, 62, -1, 67, 71, 68, -1, 74, |
| 1772 |
66, -1, 64, -1, 70, -1, -1, 69, -1, -1, 72, |
| 1773 |
73, 78, -1, -1, -1, 76, -1, -1, -1, -1, -1, |
| 1774 |
84, -1, 86, -1, 89, 79, 88, -1, 83, -1, -1, |
| 1775 |
-1, -1, -1, 85, -1, -1, 81, 139, 93, -1, -1, |
| 1776 |
-1, -1, 91, 80, 87, -1, -1, -1, -1, -1, -1, |
| 1777 |
-1, -1, -1, 82, -1, 90, -1, -1, -1, -1, -1, |
| 1778 |
99, 94, 102, -1, 97, 98, 100, -1, -1, -1, 95, |
| 1779 |
-1, 101, 96, -1, -1, -1, -1, -1, -1, -1, 104, |
| 1780 |
-1, -1, 107, -1, 105, -1, 109, -1, -1, -1, -1, |
| 1781 |
-1, -1, -1, -1, -1, -1, -1, -1, 106, -1, 103, |
| 1782 |
111, -1, -1, -1, -1, 108, -1, 110, -1, -1, -1, |
| 1783 |
-1, -1, -1, 112, -1, -1, -1, -1, -1, -1, 113, |
| 1784 |
122, 121, 115, 117, -1, 116, -1, -1, -1, -1, 118, |
| 1785 |
-1, -1, 119, 114, -1, -1, 120, -1, -1, -1, -1, |
| 1786 |
-1, 123, -1, -1, -1, -1, 124, 125, 127, 126, -1, |
| 1787 |
128, -1, -1, -1, -1, -1, -1, 129, -1, -1, -1, |
| 1788 |
-1, -1, 130, 131, -1, 133, -1, -1, 132, 134, -1, |
| 1789 |
-1, -1, -1, -1, 135, -1, 137, 136, -1, 138, -1, |
| 1790 |
-1, 144, -1, -1, -1, -1, 140, -1, -1, -1, -1, |
| 1791 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 1792 |
145, -1, -1, -1, 146, 147, -1, 143, -1, -1, -1, |
| 1793 |
148, -1, 149, 142, -1, -1, 150, -1, 154, 39, 151, |
| 1794 |
141, -1, 152, -1, -1, 153, -1, 155, -1, -1, 157, |
| 1795 |
-1, 156, -1, -1, 171, -1, 158, 169, 159, -1, -1, |
| 1796 |
-1, -1, 160, 164, 161, -1, 162, -1, -1, -1, -1, |
| 1797 |
-1, -1, 166, -1, -1, 165, 168, 163, -1, -1, 167, |
| 1798 |
-1, -1, 170, -1, -1, -1, -1, -1, 172, 173, -1, |
| 1799 |
-1, 174, 175, -1, 176, 177, 178, -1, -1, -1, -1, |
| 1800 |
-1, -1, -1, -1, 179, 180, -1, 181, -1, -1, -1, |
| 1801 |
-1, 77, 183, -1, -1, -1, -1, -1, 184, 185, -1, |
| 1802 |
186, -1, -1 |
| 1803 |
}; |
| 1804 |
private static final String[] ISO_3166_2_CODES = new String[] { |
| 1805 |
"ABW", "AFG", "AGO", "AIA", "ALA", "ALB", "AND", "ARE", "ARG", |
| 1806 |
"ARM", "ASM", "ATA", "ATF", "ATG", "AUS", "AUT", "AZE", "BDI", |
| 1807 |
"BEL", "BEN", "BES", "BFA", "BGD", "BGR", "BHR", "BHS", "BIH", |
| 1808 |
"BLM", "BLR", "BLZ", "BMU", "BOL", "BRA", "BRB", "BRN", "BTN", |
| 1809 |
"BVT", "BWA", "CAF", "CAN", "CCK", "CHE", "CHL", "CHN", "CIV", |
| 1810 |
"CMR", "COD", "COG", "COK", "COL", "COM", "CPV", "CRI", "CUB", |
| 1811 |
"CUW", "CXR", "CYM", "CYP", "CZE", "DEU", "DJI", "DMA", "DNK", |
| 1812 |
"DOM", "DZA", "ECU", "EGY", "ERI", "ESH", "ESP", "EST", "ETH", |
| 1813 |
"FIN", "FJI", "FLK", "FRA", "FRO", "FSM", "GAB", "GBR", "GEO", |
| 1814 |
"GGY", "GHA", "GIB", "GIN", "GLP", "GMB", "GNB", "GNQ", "GRC", |
| 1815 |
"GRD", "GRL", "GTM", "GUF", "GUM", "GUY", "HKG", "HMD", "HND", |
| 1816 |
"HRV", "HTI", "HUN", "IDN", "IMN", "IND", "IOT", "IRL", "IRN", |
| 1817 |
"IRQ", "ISL", "ISR", "ITA", "JAM", "JEY", "JOR", "JPN", "KAZ", |
| 1818 |
"KEN", "KGZ", "KHM", "KIR", "KNA", "KOR", "KWT", "LAO", "LBN", |
| 1819 |
"LBR", "LBY", "LCA", "LIE", "LKA", "LSO", "LTU", "LUX", "LVA", |
| 1820 |
"MAC", "MAF", "MAR", "MCO", "MDA", "MDG", "MDV", "MEX", "MHL", |
| 1821 |
"MKD", "MLI", "MLT", "MMR", "MNE", "MNG", "MNP", "MOZ", "MRT", |
| 1822 |
"MSR", "MTQ", "MUS", "MWI", "MYS", "MYT", "NAM", "NCL", "NER", |
| 1823 |
"NFK", "NGA", "NIC", "NIU", "NLD", "NOR", "NPL", "NRU", "NZL", |
| 1824 |
"OMN", "PAK", "PAN", "PCN", "PER", "PHL", "PLW", "PNG", "POL", |
| 1825 |
"PRI", "PRK", "PRT", "PRY", "PSE", "PYF", "QAT", "REU", "ROU", |
| 1826 |
"RUS", "RWA", "SAU", "SDN", "SEN", "SGP", "SGS", "SHN", "SJM", |
| 1827 |
"SLB", "SLE", "SLV", "SMR", "SOM", "SPM", "SRB", "SSD", "STP", |
| 1828 |
"SUR", "SVK", "SVN", "SWE", "SWZ", "SXM", "SYC", "SYR", "TCA", |
| 1829 |
"TCD", "TGO", "THA", "TJK", "TKL", "TKM", "TLS", "TON", "TTO", |
| 1830 |
"TUN", "TUR", "TUV", "TWN", "TZA", "UGA", "UKR", "UMI", "URY", |
| 1831 |
"USA", "UZB", "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", |
| 1832 |
"WLF", "WSM", "YEM", "ZAF", "ZMB", "ZWE" |
| 1833 |
}; |
| 1834 |
|
| 1835 |
private static final String[] ISO_3166_2_NAMES = new String[] { |
| 1836 |
"Aruba", // Code ABW/AW |
| 1837 |
"Afghanistan", // Code AFG/AF |
| 1838 |
"Angola", // Code AGO/AO |
| 1839 |
"Anguilla", // Code AIA/AI |
| 1840 |
"\u00c5land Islands", // Code ALA/AX |
| 1841 |
"Albania", // Code ALB/AL |
| 1842 |
"Andorra", // Code AND/AD |
| 1843 |
"United Arab Emirates", // Code ARE/AE |
| 1844 |
"Argentina", // Code ARG/AR |
| 1845 |
"Armenia", // Code ARM/AM |
| 1846 |
"American Samoa", // Code ASM/AS |
| 1847 |
"Antarctica", // Code ATA/AQ |
| 1848 |
"French Southern Territories", // Code ATF/TF |
| 1849 |
"Antigua & Barbuda", // Code ATG/AG |
| 1850 |
"Australia", // Code AUS/AU |
| 1851 |
"Austria", // Code AUT/AT |
| 1852 |
"Azerbaijan", // Code AZE/AZ |
| 1853 |
"Burundi", // Code BDI/BI |
| 1854 |
"Belgium", // Code BEL/BE |
| 1855 |
"Benin", // Code BEN/BJ |
| 1856 |
"Caribbean Netherlands", // Code BES/BQ |
| 1857 |
"Burkina Faso", // Code BFA/BF |
| 1858 |
"Bangladesh", // Code BGD/BD |
| 1859 |
"Bulgaria", // Code BGR/BG |
| 1860 |
"Bahrain", // Code BHR/BH |
| 1861 |
"Bahamas", // Code BHS/BS |
| 1862 |
"Bosnia & Herzegovina", // Code BIH/BA |
| 1863 |
"St. Barth\u00e9lemy", // Code BLM/BL |
| 1864 |
"Belarus", // Code BLR/BY |
| 1865 |
"Belize", // Code BLZ/BZ |
| 1866 |
"Bermuda", // Code BMU/BM |
| 1867 |
"Bolivia", // Code BOL/BO |
| 1868 |
"Brazil", // Code BRA/BR |
| 1869 |
"Barbados", // Code BRB/BB |
| 1870 |
"Brunei", // Code BRN/BN |
| 1871 |
"Bhutan", // Code BTN/BT |
| 1872 |
"Bouvet Island", // Code BVT/BV |
| 1873 |
"Botswana", // Code BWA/BW |
| 1874 |
"Central African Republic", // Code CAF/CF |
| 1875 |
"Canada", // Code CAN/CA |
| 1876 |
"Cocos (Keeling) Islands", // Code CCK/CC |
| 1877 |
"Switzerland", // Code CHE/CH |
| 1878 |
"Chile", // Code CHL/CL |
| 1879 |
"China", // Code CHN/CN |
| 1880 |
"C\u00f4te d\u2019Ivoire", // Code CIV/CI |
| 1881 |
"Cameroon", // Code CMR/CM |
| 1882 |
"Congo - Kinshasa", // Code COD/CD |
| 1883 |
"Congo - Brazzaville", // Code COG/CG |
| 1884 |
"Cook Islands", // Code COK/CK |
| 1885 |
"Colombia", // Code COL/CO |
| 1886 |
"Comoros", // Code COM/KM |
| 1887 |
"Cape Verde", // Code CPV/CV |
| 1888 |
"Costa Rica", // Code CRI/CR |
| 1889 |
"Cuba", // Code CUB/CU |
| 1890 |
"Cura\u00e7ao", // Code CUW/CW |
| 1891 |
"Christmas Island", // Code CXR/CX |
| 1892 |
"Cayman Islands", // Code CYM/KY |
| 1893 |
"Cyprus", // Code CYP/CY |
| 1894 |
"Czech Republic", // Code CZE/CZ |
| 1895 |
"Germany", // Code DEU/DE |
| 1896 |
"Djibouti", // Code DJI/DJ |
| 1897 |
"Dominica", // Code DMA/DM |
| 1898 |
"Denmark", // Code DNK/DK |
| 1899 |
"Dominican Republic", // Code DOM/DO |
| 1900 |
"Algeria", // Code DZA/DZ |
| 1901 |
"Ecuador", // Code ECU/EC |
| 1902 |
"Egypt", // Code EGY/EG |
| 1903 |
"Eritrea", // Code ERI/ER |
| 1904 |
"Western Sahara", // Code ESH/EH |
| 1905 |
"Spain", // Code ESP/ES |
| 1906 |
"Estonia", // Code EST/EE |
| 1907 |
"Ethiopia", // Code ETH/ET |
| 1908 |
"Finland", // Code FIN/FI |
| 1909 |
"Fiji", // Code FJI/FJ |
| 1910 |
"Falkland Islands", // Code FLK/FK |
| 1911 |
"France", // Code FRA/FR |
| 1912 |
"Faroe Islands", // Code FRO/FO |
| 1913 |
"Micronesia", // Code FSM/FM |
| 1914 |
"Gabon", // Code GAB/GA |
| 1915 |
"United Kingdom", // Code GBR/GB |
| 1916 |
"Georgia", // Code GEO/GE |
| 1917 |
"Guernsey", // Code GGY/GG |
| 1918 |
"Ghana", // Code GHA/GH |
| 1919 |
"Gibraltar", // Code GIB/GI |
| 1920 |
"Guinea", // Code GIN/GN |
| 1921 |
"Guadeloupe", // Code GLP/GP |
| 1922 |
"Gambia", // Code GMB/GM |
| 1923 |
"Guinea-Bissau", // Code GNB/GW |
| 1924 |
"Equatorial Guinea", // Code GNQ/GQ |
| 1925 |
"Greece", // Code GRC/GR |
| 1926 |
"Grenada", // Code GRD/GD |
| 1927 |
"Greenland", // Code GRL/GL |
| 1928 |
"Guatemala", // Code GTM/GT |
| 1929 |
"French Guiana", // Code GUF/GF |
| 1930 |
"Guam", // Code GUM/GU |
| 1931 |
"Guyana", // Code GUY/GY |
| 1932 |
"Hong Kong SAR China", // Code HKG/HK |
| 1933 |
"Heard Island and McDonald Islands", // Code HMD/HM |
| 1934 |
"Honduras", // Code HND/HN |
| 1935 |
"Croatia", // Code HRV/HR |
| 1936 |
"Haiti", // Code HTI/HT |
| 1937 |
"Hungary", // Code HUN/HU |
| 1938 |
"Indonesia", // Code IDN/ID |
| 1939 |
"Isle of Man", // Code IMN/IM |
| 1940 |
"India", // Code IND/IN |
| 1941 |
"British Indian Ocean Territory", // Code IOT/IO |
| 1942 |
"Ireland", // Code IRL/IE |
| 1943 |
"Iran", // Code IRN/IR |
| 1944 |
"Iraq", // Code IRQ/IQ |
| 1945 |
"Iceland", // Code ISL/IS |
| 1946 |
"Israel", // Code ISR/IL |
| 1947 |
"Italy", // Code ITA/IT |
| 1948 |
"Jamaica", // Code JAM/JM |
| 1949 |
"Jersey", // Code JEY/JE |
| 1950 |
"Jordan", // Code JOR/JO |
| 1951 |
"Japan", // Code JPN/JP |
| 1952 |
"Kazakhstan", // Code KAZ/KZ |
| 1953 |
"Kenya", // Code KEN/KE |
| 1954 |
"Kyrgyzstan", // Code KGZ/KG |
| 1955 |
"Cambodia", // Code KHM/KH |
| 1956 |
"Kiribati", // Code KIR/KI |
| 1957 |
"St. Kitts & Nevis", // Code KNA/KN |
| 1958 |
"South Korea", // Code KOR/KR |
| 1959 |
"Kuwait", // Code KWT/KW |
| 1960 |
"Laos", // Code LAO/LA |
| 1961 |
"Lebanon", // Code LBN/LB |
| 1962 |
"Liberia", // Code LBR/LR |
| 1963 |
"Libya", // Code LBY/LY |
| 1964 |
"St. Lucia", // Code LCA/LC |
| 1965 |
"Liechtenstein", // Code LIE/LI |
| 1966 |
"Sri Lanka", // Code LKA/LK |
| 1967 |
"Lesotho", // Code LSO/LS |
| 1968 |
"Lithuania", // Code LTU/LT |
| 1969 |
"Luxembourg", // Code LUX/LU |
| 1970 |
"Latvia", // Code LVA/LV |
| 1971 |
"Macau SAR China", // Code MAC/MO |
| 1972 |
"St. Martin", // Code MAF/MF |
| 1973 |
"Morocco", // Code MAR/MA |
| 1974 |
"Monaco", // Code MCO/MC |
| 1975 |
"Moldova", // Code MDA/MD |
| 1976 |
"Madagascar", // Code MDG/MG |
| 1977 |
"Maldives", // Code MDV/MV |
| 1978 |
"Mexico", // Code MEX/MX |
| 1979 |
"Marshall Islands", // Code MHL/MH |
| 1980 |
"Macedonia", // Code MKD/MK |
| 1981 |
"Mali", // Code MLI/ML |
| 1982 |
"Malta", // Code MLT/MT |
| 1983 |
"Myanmar (Burma)", // Code MMR/MM |
| 1984 |
"Montenegro", // Code MNE/ME |
| 1985 |
"Mongolia", // Code MNG/MN |
| 1986 |
"Northern Mariana Islands", // Code MNP/MP |
| 1987 |
"Mozambique", // Code MOZ/MZ |
| 1988 |
"Mauritania", // Code MRT/MR |
| 1989 |
"Montserrat", // Code MSR/MS |
| 1990 |
"Martinique", // Code MTQ/MQ |
| 1991 |
"Mauritius", // Code MUS/MU |
| 1992 |
"Malawi", // Code MWI/MW |
| 1993 |
"Malaysia", // Code MYS/MY |
| 1994 |
"Mayotte", // Code MYT/YT |
| 1995 |
"Namibia", // Code NAM/NA |
| 1996 |
"New Caledonia", // Code NCL/NC |
| 1997 |
"Niger", // Code NER/NE |
| 1998 |
"Norfolk Island", // Code NFK/NF |
| 1999 |
"Nigeria", // Code NGA/NG |
| 2000 |
"Nicaragua", // Code NIC/NI |
| 2001 |
"Niue", // Code NIU/NU |
| 2002 |
"Netherlands", // Code NLD/NL |
| 2003 |
"Norway", // Code NOR/NO |
| 2004 |
"Nepal", // Code NPL/NP |
| 2005 |
"Nauru", // Code NRU/NR |
| 2006 |
"New Zealand", // Code NZL/NZ |
| 2007 |
"Oman", // Code OMN/OM |
| 2008 |
"Pakistan", // Code PAK/PK |
| 2009 |
"Panama", // Code PAN/PA |
| 2010 |
"Pitcairn Islands", // Code PCN/PN |
| 2011 |
"Peru", // Code PER/PE |
| 2012 |
"Philippines", // Code PHL/PH |
| 2013 |
"Palau", // Code PLW/PW |
| 2014 |
"Papua New Guinea", // Code PNG/PG |
| 2015 |
"Poland", // Code POL/PL |
| 2016 |
"Puerto Rico", // Code PRI/PR |
| 2017 |
"North Korea", // Code PRK/KP |
| 2018 |
"Portugal", // Code PRT/PT |
| 2019 |
"Paraguay", // Code PRY/PY |
| 2020 |
"Palestine", // Code PSE/PS |
| 2021 |
"French Polynesia", // Code PYF/PF |
| 2022 |
"Qatar", // Code QAT/QA |
| 2023 |
"R\u00e9union", // Code REU/RE |
| 2024 |
"Romania", // Code ROU/RO |
| 2025 |
"Russia", // Code RUS/RU |
| 2026 |
"Rwanda", // Code RWA/RW |
| 2027 |
"Saudi Arabia", // Code SAU/SA |
| 2028 |
"Sudan", // Code SDN/SD |
| 2029 |
"Senegal", // Code SEN/SN |
| 2030 |
"Singapore", // Code SGP/SG |
| 2031 |
"South Georgia and the South Sandwich Islands",// Code SGS/GS |
| 2032 |
"St. Helena", // Code SHN/SH |
| 2033 |
"Svalbard & Jan Mayen", // Code SJM/SJ |
| 2034 |
"Solomon Islands", // Code SLB/SB |
| 2035 |
"Sierra Leone", // Code SLE/SL |
| 2036 |
"El Salvador", // Code SLV/SV |
| 2037 |
"San Marino", // Code SMR/SM |
| 2038 |
"Somalia", // Code SOM/SO |
| 2039 |
"St. Pierre & Miquelon", // Code SPM/PM |
| 2040 |
"Serbia", // Code SRB/RS |
| 2041 |
"South Sudan", // Code SSD/SS |
| 2042 |
"S\u00e3o Tom\u00e9 & Pr\u00edncipe", // Code STP/ST |
| 2043 |
"Suriname", // Code SUR/SR |
| 2044 |
"Slovakia", // Code SVK/SK |
| 2045 |
"Slovenia", // Code SVN/SI |
| 2046 |
"Sweden", // Code SWE/SE |
| 2047 |
"Swaziland", // Code SWZ/SZ |
| 2048 |
"Sint Maarten", // Code SXM/SX |
| 2049 |
"Seychelles", // Code SYC/SC |
| 2050 |
"Syria", // Code SYR/SY |
| 2051 |
"Turks & Caicos Islands", // Code TCA/TC |
| 2052 |
"Chad", // Code TCD/TD |
| 2053 |
"Togo", // Code TGO/TG |
| 2054 |
"Thailand", // Code THA/TH |
| 2055 |
"Tajikistan", // Code TJK/TJ |
| 2056 |
"Tokelau", // Code TKL/TK |
| 2057 |
"Turkmenistan", // Code TKM/TM |
| 2058 |
"Timor-Leste", // Code TLS/TL |
| 2059 |
"Tonga", // Code TON/TO |
| 2060 |
"Trinidad & Tobago", // Code TTO/TT |
| 2061 |
"Tunisia", // Code TUN/TN |
| 2062 |
"Turkey", // Code TUR/TR |
| 2063 |
"Tuvalu", // Code TUV/TV |
| 2064 |
"Taiwan", // Code TWN/TW |
| 2065 |
"Tanzania", // Code TZA/TZ |
| 2066 |
"Uganda", // Code UGA/UG |
| 2067 |
"Ukraine", // Code UKR/UA |
| 2068 |
"U.S. Outlying Islands", // Code UMI/UM |
| 2069 |
"Uruguay", // Code URY/UY |
| 2070 |
"United States", // Code USA/US |
| 2071 |
"Uzbekistan", // Code UZB/UZ |
| 2072 |
"Holy See (Vatican City State)", // Code VAT/VA |
| 2073 |
"St. Vincent & Grenadines", // Code VCT/VC |
| 2074 |
"Venezuela", // Code VEN/VE |
| 2075 |
"British Virgin Islands", // Code VGB/VG |
| 2076 |
"U.S. Virgin Islands", // Code VIR/VI |
| 2077 |
"Vietnam", // Code VNM/VN |
| 2078 |
"Vanuatu", // Code VUT/VU |
| 2079 |
"Wallis & Futuna", // Code WLF/WF |
| 2080 |
"Samoa", // Code WSM/WS |
| 2081 |
"Yemen", // Code YEM/YE |
| 2082 |
"South Africa", // Code ZAF/ZA |
| 2083 |
"Zambia", // Code ZMB/ZM |
| 2084 |
"Zimbabwe" // Code ZWE/ZW |
| 2085 |
}; |
| 2086 |
|
| 2087 |
private static final String[] ISO_3166_1_CODES = new String[] { |
| 2088 |
"AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", |
| 2089 |
"AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", |
| 2090 |
"BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", |
| 2091 |
"BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", |
| 2092 |
"CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", |
| 2093 |
"CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", |
| 2094 |
"ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", |
| 2095 |
"GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", |
| 2096 |
"GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", |
| 2097 |
"HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", |
| 2098 |
"JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", |
| 2099 |
"KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", |
| 2100 |
"LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", |
| 2101 |
"MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", |
| 2102 |
"MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", |
| 2103 |
"NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", |
| 2104 |
"PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", |
| 2105 |
"RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", |
| 2106 |
"SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", |
| 2107 |
"SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", |
| 2108 |
"TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", |
| 2109 |
"UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", |
| 2110 |
"WF", "WS", "YE", "YT", "ZA", "ZM", "ZW" |
| 2111 |
}; |
| 2112 |
|
| 2113 |
// Each element corresponds to an ISO2 code, and contains the index |
| 2114 |
// for the corresponding ISO3 code |
| 2115 |
private static final int[] ISO_3166_1_TO_2 = new int[] { |
| 2116 |
6, 7, 1, 13, 3, 5, 9, 2, 11, 8, 10, |
| 2117 |
15, 14, 0, 4, 16, 26, 33, 22, 18, 21, 23, |
| 2118 |
24, 17, 19, 27, 30, 34, 31, 20, 32, 25, 35, |
| 2119 |
36, 37, 28, 29, 39, 40, 46, 38, 47, 41, 44, |
| 2120 |
48, 42, 45, 43, 49, 52, 53, 51, 54, 55, 57, |
| 2121 |
58, 59, 60, 62, 61, 63, 64, 65, 70, 66, 68, |
| 2122 |
67, 69, 71, 72, 73, 74, 77, 76, 75, 78, 79, |
| 2123 |
90, 80, 93, 81, 82, 83, 91, 86, 84, 85, 88, |
| 2124 |
89, 195, 92, 94, 87, 95, 96, 97, 98, 99, 100, |
| 2125 |
101, 102, 106, 110, 103, 104, 105, 108, 107, 109, 111, |
| 2126 |
113, 112, 114, 115, 117, 118, 119, 120, 50, 121, 181, |
| 2127 |
122, 123, 56, 116, 124, 125, 128, 129, 130, 126, 131, |
| 2128 |
132, 133, 134, 127, 137, 138, 139, 148, 136, 140, 143, |
| 2129 |
144, 145, 147, 149, 135, 150, 154, 152, 153, 146, 155, |
| 2130 |
141, 156, 142, 157, 151, 159, 160, 161, 162, 163, 164, |
| 2131 |
166, 167, 168, 169, 165, 170, 171, 173, 175, 185, 178, |
| 2132 |
176, 172, 179, 203, 174, 180, 184, 182, 177, 183, 186, |
| 2133 |
187, 188, 204, 189, 190, 191, 198, 213, 192, 210, 194, |
| 2134 |
196, 209, 197, 208, 199, 201, 193, 202, 207, 205, 206, |
| 2135 |
200, 212, 214, 211, 215, 216, 12, 217, 218, 219, 220, |
| 2136 |
222, 221, 225, 223, 226, 224, 227, 228, 229, 231, 230, |
| 2137 |
232, 234, 233, 235, 236, 237, 238, 239, 240, 241, 242, |
| 2138 |
243, 244, 245, 158, 246, 247, 248 |
| 2139 |
}; |
| 2140 |
|
| 2141 |
// Each element corresponds to an ISO3 code, and contains the index |
| 2142 |
// for the corresponding ISO2 code, or -1 if not represented |
| 2143 |
private static final int[] ISO_3166_2_TO_1 = new int[] { |
| 2144 |
13, 2, 7, 4, 14, 5, 0, 1, 9, 6, 10, |
| 2145 |
8, 215, 3, 12, 11, 15, 23, 19, 24, 29, 20, |
| 2146 |
18, 21, 22, 31, 16, 25, 35, 36, 26, 28, 30, |
| 2147 |
17, 27, 32, 33, 34, 40, 37, 38, 42, 45, 47, |
| 2148 |
43, 46, 39, 41, 44, 48, 118, 51, 49, 50, 52, |
| 2149 |
53, 123, 54, 55, 56, 57, 59, 58, 60, 61, 62, |
| 2150 |
64, 66, 65, 67, 63, 68, 69, 70, 71, 74, 73, |
| 2151 |
72, 75, 76, 78, 80, 81, 82, 85, 86, 84, 92, |
| 2152 |
87, 88, 77, 83, 90, 79, 91, 93, 94, 95, 96, |
| 2153 |
97, 98, 99, 100, 103, 104, 105, 101, 107, 106, 108, |
| 2154 |
102, 109, 111, 110, 112, 113, 124, 114, 115, 116, 117, |
| 2155 |
119, 121, 122, 125, 126, 130, 135, 127, 128, 129, 131, |
| 2156 |
132, 133, 134, 147, 140, 136, 137, 138, 141, 154, 156, |
| 2157 |
142, 143, 144, 152, 145, 139, 146, 148, 158, 150, 151, |
| 2158 |
149, 153, 155, 157, 245, 159, 160, 161, 162, 163, 164, |
| 2159 |
169, 165, 166, 167, 168, 170, 171, 177, 172, 180, 173, |
| 2160 |
176, 184, 175, 178, 181, 120, 183, 185, 182, 174, 186, |
| 2161 |
187, 188, 190, 191, 192, 195, 204, 197, 89, 198, 200, |
| 2162 |
193, 202, 209, 203, 205, 179, 189, 207, 208, 206, 201, |
| 2163 |
199, 196, 212, 210, 194, 211, 213, 214, 216, 217, 218, |
| 2164 |
219, 221, 220, 223, 225, 222, 224, 226, 227, 228, 230, |
| 2165 |
229, 231, 233, 232, 234, 235, 236, 237, 238, 239, 240, |
| 2166 |
241, 242, 243, 244, 246, 247, 248 |
| 2167 |
}; |
| 2168 |
// Language afr: ZAF,NAM |
| 2169 |
private static final int[] REGIONS_AFR = new int[] { 246,159 }; |
| 2170 |
// Language ara: ARE,BHR,COM,DJI,DZA,EGY,ERI,ESH,IRQ,ISR,JOR,KWT,LBN,LBY,MAR,MRT,OMN,PSE,QAT,SAU,SDN,SOM,SSD,SYR,TCD,TUN,YEM |
| 2171 |
private static final int[] REGIONS_ARA = new int[] { 7,24,50,60,64,66,67,68,108,110,114,123,125,127,137,152,171,184,186,191,192,202,205,214,216,225,245 }; |
| 2172 |
// Language ben: BGD,IND |
| 2173 |
private static final int[] REGIONS_BEN = new int[] { 22,104 }; |
| 2174 |
// Language bod: CHN,IND |
| 2175 |
private static final int[] REGIONS_BOD = new int[] { 43,104 }; |
| 2176 |
// Language cat: AND,ESP,FRA,ITA |
| 2177 |
private static final int[] REGIONS_CAT = new int[] { 6,69,75,111 }; |
| 2178 |
// Language dan: DNK,GRL |
| 2179 |
private static final int[] REGIONS_DAN = new int[] { 62,91 }; |
| 2180 |
// Language deu: DEU,AUT,BEL,CHE,LIE,LUX |
| 2181 |
private static final int[] REGIONS_DEU = new int[] { 59,15,18,41,129,133 }; |
| 2182 |
// Language ell: GRC,CYP |
| 2183 |
private static final int[] REGIONS_ELL = new int[] { 89,57 }; |
| 2184 |
// Language eng: USA,AIA,ASM,ATG,AUS,BEL,BHS,BLZ,BMU,BRB,BWA,CAN,CCK,CMR,COK,CXR,CYM,DMA,ERI,FJI,FLK,FSM,GBR,GGY,GHA,GIB,GMB,GRD,GUM,GUY,HKG,IMN,IND,IOT,IRL,JAM,JEY,KEN,KIR,KNA,LBR,LCA,LSO,MAC,MDG,MHL,MLT,MNP,MSR,MUS,MWI,MYS,NAM,NFK,NGA,NIU,NRU,NZL,PAK,PCN,PHL,PLW,PNG,PRI,RWA,SDN,SGP,SHN,SLB,SLE,SSD,SWZ,SXM,SYC,TCA,TKL,TON,TTO,TUV,TZA,UGA,UMI,VCT,VGB,VIR,VUT,WSM,ZAF,ZMB,ZWE |
| 2185 |
private static final int[] REGIONS_ENG = new int[] { 234,3,10,13,14,18,25,29,30,33,37,39,40,45,48,55,56,61,67,73,74,77,79,81,82,83,86,90,94,95,96,103,104,105,106,112,113,117,120,121,126,128,131,135,140,143,146,150,153,155,156,157,159,162,163,165,169,170,172,174,176,177,178,180,190,192,194,196,198,199,205,211,212,213,215,220,223,224,227,229,230,232,237,239,240,242,244,246,247,248 }; |
| 2186 |
// Language ewe: GHA,TGO |
| 2187 |
private static final int[] REGIONS_EWE = new int[] { 82,217 }; |
| 2188 |
// Language fas: IRN,AFG |
| 2189 |
private static final int[] REGIONS_FAS = new int[] { 107,1 }; |
| 2190 |
// Language fra: FRA,BDI,BEL,BEN,BFA,BLM,CAF,CAN,CHE,CIV,CMR,COD,COG,COM,DJI,DZA,GAB,GIN,GLP,GNQ,GUF,HTI,LUX,MAF,MAR,MCO,MDG,MLI,MRT,MTQ,MUS,MYT,NCL,NER,PYF,REU,RWA,SEN,SPM,SYC,SYR,TCD,TGO,TUN,VUT,WLF |
| 2191 |
private static final int[] REGIONS_FRA = new int[] { 75,17,18,19,21,27,38,39,41,44,45,46,47,50,60,64,78,84,85,88,93,100,133,136,137,138,140,145,152,154,155,158,160,161,185,187,190,193,203,213,214,216,217,225,242,243 }; |
| 2192 |
// Language ful: SEN,CMR,GIN,MRT |
| 2193 |
private static final int[] REGIONS_FUL = new int[] { 193,45,84,152 }; |
| 2194 |
// Language gsw: CHE,FRA,LIE |
| 2195 |
private static final int[] REGIONS_GSW = new int[] { 41,75,129 }; |
| 2196 |
// Language hau: NGA,GHA,NER |
| 2197 |
private static final int[] REGIONS_HAU = new int[] { 163,82,161 }; |
| 2198 |
// Language hrv: HRV,BIH |
| 2199 |
private static final int[] REGIONS_HRV = new int[] { 99,26 }; |
| 2200 |
// Language ita: ITA,CHE,SMR |
| 2201 |
private static final int[] REGIONS_ITA = new int[] { 111,41,201 }; |
| 2202 |
// Language kor: KOR,PRK |
| 2203 |
private static final int[] REGIONS_KOR = new int[] { 122,181 }; |
| 2204 |
// Language lin: COD,AGO,CAF,COG |
| 2205 |
private static final int[] REGIONS_LIN = new int[] { 46,2,38,47 }; |
| 2206 |
// Language mas: KEN,TZA |
| 2207 |
private static final int[] REGIONS_MAS = new int[] { 117,229 }; |
| 2208 |
// Language msa: MYS,BRN,SGP |
| 2209 |
private static final int[] REGIONS_MSA = new int[] { 157,34,194 }; |
| 2210 |
// Language nep: NPL,IND |
| 2211 |
private static final int[] REGIONS_NEP = new int[] { 168,104 }; |
| 2212 |
// Language nld: NLD,ABW,BEL,BES,CUW,SUR,SXM |
| 2213 |
private static final int[] REGIONS_NLD = new int[] { 166,0,18,20,54,207,212 }; |
| 2214 |
// Language nob: NOR,SJM |
| 2215 |
private static final int[] REGIONS_NOB = new int[] { 167,197 }; |
| 2216 |
// Language orm: ETH,KEN |
| 2217 |
private static final int[] REGIONS_ORM = new int[] { 71,117 }; |
| 2218 |
// Language oss: RUS,GEO |
| 2219 |
private static final int[] REGIONS_OSS = new int[] { 189,80 }; |
| 2220 |
// Language pan: PAK,IND |
| 2221 |
private static final int[] REGIONS_PAN = new int[] { 172,104 }; |
| 2222 |
// Language por: PRT,AGO,BRA,CPV,GNB,MAC,MOZ,STP,TLS |
| 2223 |
private static final int[] REGIONS_POR = new int[] { 182,2,32,51,87,135,151,206,222 }; |
| 2224 |
// Language que: PER,BOL,ECU |
| 2225 |
private static final int[] REGIONS_QUE = new int[] { 175,31,65 }; |
| 2226 |
// Language ron: ROU,MDA |
| 2227 |
private static final int[] REGIONS_RON = new int[] { 188,139 }; |
| 2228 |
// Language rus: RUS,BLR,KAZ,KGZ,MDA,UKR |
| 2229 |
private static final int[] REGIONS_RUS = new int[] { 189,28,116,118,139,231 }; |
| 2230 |
// Language sme: NOR,FIN,SWE |
| 2231 |
private static final int[] REGIONS_SME = new int[] { 167,72,210 }; |
| 2232 |
// Language som: SOM,DJI,ETH,KEN |
| 2233 |
private static final int[] REGIONS_SOM = new int[] { 202,60,71,117 }; |
| 2234 |
// Language spa: ESP,ARG,BOL,CHL,COL,CRI,CUB,DOM,ECU,GNQ,GTM,HND,MEX,NIC,PAN,PER,PHL,PRI,PRY,SLV,URY,USA,VEN |
| 2235 |
private static final int[] REGIONS_SPA = new int[] { 69,8,31,42,49,52,53,63,65,88,92,98,142,164,173,175,176,180,183,200,233,234,238 }; |
| 2236 |
// Language sqi: ALB,MKD |
| 2237 |
private static final int[] REGIONS_SQI = new int[] { 5,144 }; |
| 2238 |
// Language srp: SRB,BIH,MNE |
| 2239 |
private static final int[] REGIONS_SRP = new int[] { 204,26,148 }; |
| 2240 |
// Language swa: TZA,KEN,UGA |
| 2241 |
private static final int[] REGIONS_SWA = new int[] { 229,117,230 }; |
| 2242 |
// Language swe: SWE,ALA,FIN |
| 2243 |
private static final int[] REGIONS_SWE = new int[] { 210,4,72 }; |
| 2244 |
// Language tam: IND,LKA,MYS,SGP |
| 2245 |
private static final int[] REGIONS_TAM = new int[] { 104,130,157,194 }; |
| 2246 |
// Language teo: KEN,UGA |
| 2247 |
private static final int[] REGIONS_TEO = new int[] { 117,230 }; |
| 2248 |
// Language tir: ERI,ETH |
| 2249 |
private static final int[] REGIONS_TIR = new int[] { 67,71 }; |
| 2250 |
// Language tur: TUR,CYP |
| 2251 |
private static final int[] REGIONS_TUR = new int[] { 226,57 }; |
| 2252 |
// Language urd: IND,PAK |
| 2253 |
private static final int[] REGIONS_URD = new int[] { 104,172 }; |
| 2254 |
// Language uzb: UZB,AFG |
| 2255 |
private static final int[] REGIONS_UZB = new int[] { 235,1 }; |
| 2256 |
// Language yor: NGA,BEN |
| 2257 |
private static final int[] REGIONS_YOR = new int[] { 163,19 }; |
| 2258 |
// Language zho: CHN,HKG,MAC,SGP,TWN |
| 2259 |
private static final int[] REGIONS_ZHO = new int[] { 43,96,135,194,228 }; |
| 2260 |
|
| 2261 |
private static final int[][] LANGUAGE_REGIONS = new int[][] { |
| 2262 |
null, null, null, null, null, null, null, null, REGIONS_AFR, |
| 2263 |
null, null, null, null, null, null, null, null, null, |
| 2264 |
null, null, REGIONS_ARA, null, null, null, null, null, |
| 2265 |
null, null, null, null, null, null, null, null, null, |
| 2266 |
null, null, null, null, null, null, null, null, null, |
| 2267 |
null, null, null, null, REGIONS_BEN, null, null, null, |
| 2268 |
null, null, null, null, null, null, REGIONS_BOD, null, |
| 2269 |
null, null, null, null, null, null, null, null, null, |
| 2270 |
null, null, REGIONS_CAT, null, null, null, null, null, |
| 2271 |
null, null, null, null, null, null, null, null, null, |
| 2272 |
null, null, null, null, null, null, null, null, null, |
| 2273 |
null, null, null, null, null, null, null, null, null, |
| 2274 |
REGIONS_DAN, null, null, null, null, null, REGIONS_DEU, |
| 2275 |
null, null, null, null, null, null, null, null, null, |
| 2276 |
null, null, null, null, null, null, null, REGIONS_ELL, |
| 2277 |
null, REGIONS_ENG, null, null, null, null, REGIONS_EWE, |
| 2278 |
null, null, null, REGIONS_FAS, null, null, null, null, |
| 2279 |
null, null, REGIONS_FRA, null, null, null, null, null, |
| 2280 |
REGIONS_FUL, null, null, null, null, null, null, null, |
| 2281 |
null, null, null, null, null, null, null, null, null, |
| 2282 |
null, null, null, REGIONS_GSW, null, null, null, null, |
| 2283 |
null, REGIONS_HAU, null, null, null, null, null, null, |
| 2284 |
null, null, null, REGIONS_HRV, null, null, null, null, |
| 2285 |
null, null, null, null, null, null, null, null, null, |
| 2286 |
null, null, null, null, null, null, null, null, REGIONS_ITA, |
| 2287 |
null, null, null, null, null, null, null, null, null, |
| 2288 |
null, null, null, null, null, null, null, null, null, |
| 2289 |
null, null, null, null, null, null, null, null, null, |
| 2290 |
null, null, null, null, null, null, null, null, null, |
| 2291 |
REGIONS_KOR, null, null, null, null, null, null, null, |
| 2292 |
null, null, null, null, null, null, null, null, null, |
| 2293 |
null, null, null, null, null, null, REGIONS_LIN, null, |
| 2294 |
null, null, null, null, null, null, null, null, null, |
| 2295 |
null, null, null, null, null, null, null, null, null, |
| 2296 |
null, null, null, null, REGIONS_MAS, null, null, null, |
| 2297 |
null, null, null, null, null, null, null, null, null, |
| 2298 |
null, null, null, null, null, null, null, null, null, |
| 2299 |
REGIONS_MSA, null, null, null, null, null, null, null, |
| 2300 |
null, null, null, null, null, null, null, null, null, |
| 2301 |
null, null, null, REGIONS_NEP, null, null, null, null, |
| 2302 |
REGIONS_NLD, null, null, null, REGIONS_NOB, null, null, |
| 2303 |
null, null, null, null, null, null, null, null, null, |
| 2304 |
null, null, null, null, null, REGIONS_ORM, null, REGIONS_OSS, |
| 2305 |
null, null, null, null, null, null, REGIONS_PAN, null, |
| 2306 |
null, null, null, null, null, null, null, REGIONS_POR, |
| 2307 |
null, null, null, REGIONS_QUE, null, null, null, null, |
| 2308 |
null, null, null, REGIONS_RON, null, null, REGIONS_RUS, |
| 2309 |
null, null, null, null, null, null, null, null, null, |
| 2310 |
null, null, null, null, null, null, null, null, null, |
| 2311 |
null, null, null, null, null, null, null, null, null, |
| 2312 |
null, null, null, REGIONS_SME, null, null, null, null, |
| 2313 |
null, null, null, null, null, REGIONS_SOM, null, null, |
| 2314 |
REGIONS_SPA, REGIONS_SQI, null, null, REGIONS_SRP, null, |
| 2315 |
null, null, null, null, null, null, REGIONS_SWA, null, |
| 2316 |
REGIONS_SWE, null, null, null, null, REGIONS_TAM, null, |
| 2317 |
null, null, REGIONS_TEO, null, null, null, null, null, |
| 2318 |
null, REGIONS_TIR, null, null, null, null, null, null, |
| 2319 |
null, null, null, null, null, null, null, null, REGIONS_TUR, |
| 2320 |
null, null, null, null, null, null, null, null, null, |
| 2321 |
null, null, null, REGIONS_URD, REGIONS_UZB, null, null, |
| 2322 |
null, null, null, null, null, null, null, null, null, |
| 2323 |
null, null, null, null, null, null, null, null, null, |
| 2324 |
null, REGIONS_YOR, null, null, null, null, null, null, |
| 2325 |
REGIONS_ZHO, null, null, null, null |
| 2326 |
}; |
| 2327 |
|
| 2328 |
private static final int[] LANGUAGE_REGION = new int[] { |
| 2329 |
71, 80, -1, -1, -1, -1, -1, -1, |
| 2330 |
246, 45, -1, 82, -1, -1, -1, -1, |
| 2331 |
71, -1, -1, -1, 7, -1, 69, -1, |
| 2332 |
-1, -1, -1, 229, 104, -1, -1, -1, |
| 2333 |
16, -1, -1, 31, 16, -1, -1, 189, |
| 2334 |
-1, 145, -1, 45, -1, -1, 28, 247, |
| 2335 |
22, -1, 229, -1, 104, -1, -1, 242, |
| 2336 |
-1, -1, 43, 26, -1, 75, 104, -1, |
| 2337 |
-1, -1, 23, -1, -1, -1, -1, 6, |
| 2338 |
-1, -1, -1, 58, 230, 94, -1, 189, |
| 2339 |
-1, -1, -1, -1, -1, -1, 234, -1, |
| 2340 |
189, -1, -1, -1, 79, 75, -1, -1, |
| 2341 |
-1, 39, -1, -1, -1, -1, 79, -1, |
| 2342 |
62, -1, 117, -1, -1, -1, 59, -1, |
| 2343 |
-1, 141, 161, -1, -1, 59, 45, -1, |
| 2344 |
193, -1, 35, 117, -1, -1, -1, 89, |
| 2345 |
-1, 234, -1, -1, 70, 69, 82, 45, |
| 2346 |
-1, 76, 107, -1, 73, 176, 72, -1, |
| 2347 |
-1, 75, -1, -1, -1, -1, 166, 193, |
| 2348 |
111, -1, -1, -1, -1, -1, -1, 79, |
| 2349 |
106, 69, 103, -1, -1, -1, -1, -1, |
| 2350 |
-1, -1, 183, 41, 104, 117, -1, -1, |
| 2351 |
100, 163, 234, 110, 159, -1, -1, 104, |
| 2352 |
-1, -1, 178, 99, 59, 101, -1, 9, |
| 2353 |
-1, 163, -1, 43, -1, 39, -1, -1, |
| 2354 |
-1, -1, 102, -1, -1, 234, -1, -1, |
| 2355 |
109, 111, 102, -1, 45, 229, 115, -1, |
| 2356 |
-1, -1, 64, -1, 91, 117, 104, -1, |
| 2357 |
104, 80, 163, -1, 116, -1, 229, 51, |
| 2358 |
-1, -1, 119, -1, 145, 117, 190, 118, |
| 2359 |
45, 117, -1, 104, 189, 2, 122, -1, |
| 2360 |
-1, -1, -1, -1, -1, 229, 45, 59, |
| 2361 |
2, -1, -1, -1, -1, 229, -1, -1, |
| 2362 |
124, -1, 134, -1, 166, 46, 132, 234, |
| 2363 |
-1, -1, 133, -1, 46, 230, -1, -1, |
| 2364 |
117, -1, 117, -1, -1, 143, -1, -1, |
| 2365 |
104, -1, 170, -1, 104, 117, -1, -1, |
| 2366 |
-1, 117, 155, -1, 151, 45, -1, -1, |
| 2367 |
-1, 144, -1, 140, 146, -1, -1, -1, |
| 2368 |
-1, 149, -1, 157, 45, -1, -1, -1, |
| 2369 |
-1, -1, 147, -1, -1, -1, -1, -1, |
| 2370 |
159, 169, 234, 246, 248, 159, -1, 168, |
| 2371 |
-1, -1, -1, -1, 166, 45, 45, 167, |
| 2372 |
167, -1, -1, 167, -1, -1, -1, 192, |
| 2373 |
-1, 156, -1, 230, -1, -1, 75, 39, |
| 2374 |
104, 71, -1, 189, -1, -1, -1, -1, |
| 2375 |
-1, -1, 172, -1, -1, -1, -1, -1, |
| 2376 |
-1, 179, -1, 182, -1, -1, 1, 175, |
| 2377 |
-1, -1, -1, -1, 229, 41, -1, 188, |
| 2378 |
17, -1, 189, 229, -1, 38, 189, -1, |
| 2379 |
-1, -1, 104, 117, -1, -1, 229, -1, |
| 2380 |
-1, 151, -1, -1, 145, -1, -1, 137, |
| 2381 |
-1, -1, 130, -1, -1, -1, 208, 209, |
| 2382 |
-1, 167, -1, -1, 72, 244, -1, 248, |
| 2383 |
172, -1, -1, 202, -1, 131, 69, 5, |
| 2384 |
111, -1, 204, -1, -1, 211, -1, 102, |
| 2385 |
-1, -1, 229, 46, 210, -1, -1, 185, |
| 2386 |
-1, 104, 189, 104, -1, 117, -1, -1, |
| 2387 |
219, 176, 218, -1, 67, -1, -1, -1, |
| 2388 |
-1, -1, -1, 223, -1, -1, 37, 151, |
| 2389 |
221, -1, -1, 226, -1, -1, 82, 161, |
| 2390 |
-1, 137, -1, -1, 43, 231, -1, -1, |
| 2391 |
104, 235, 126, 246, 241, -1, -1, 229, |
| 2392 |
41, -1, -1, -1, -1, -1, 18, 193, |
| 2393 |
-1, 246, 230, -1, -1, 45, 234, 163, |
| 2394 |
-1, -1, -1, -1, -1, 43, 43, -1, |
| 2395 |
246, -1, -1 |
| 2396 |
}; |
| 2397 |
|
| 2398 |
static { |
| 2399 |
// These maps should have been generated programmatically; look for accidental edits |
| 2400 |
assert ISO_639_2_CODES.length == 531; |
| 2401 |
assert ISO_639_2_NAMES.length == 531; |
| 2402 |
assert ISO_639_2_TO_1.length == 531; |
| 2403 |
assert ISO_639_1_CODES.length == 187; |
| 2404 |
assert ISO_639_1_TO_2.length == 187; |
| 2405 |
|
| 2406 |
assert ISO_3166_2_CODES.length == 249; |
| 2407 |
assert ISO_3166_2_NAMES.length == 249; |
| 2408 |
assert ISO_3166_2_TO_1.length == 249; |
| 2409 |
assert ISO_3166_1_CODES.length == 249; |
| 2410 |
assert ISO_3166_1_TO_2.length == 249; |
| 2411 |
|
| 2412 |
assert LANGUAGE_REGION.length == 531; |
| 2413 |
assert LANGUAGE_REGIONS.length == 531; |
| 2414 |
} |
| 2415 |
} |