312 }
313 }
314 return tagset;
315 }
316
317 protected Set<String> createLanguageTagSet(String category) {
318 String supportedLocaleString = LocaleDataMetaInfo.getSupportedLocaleString(category);
319 Set<String> tagset = new HashSet<>();
320 StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
321 while (tokens.hasMoreTokens()) {
322 String token = tokens.nextToken();
323 if (token.equals("|")) {
324 if (isNonUSLangSupported()) {
325 continue;
326 }
327 break;
328 }
329 tagset.add(token);
330 }
331
332 // ensure en-US is there (mandated by the spec, e.g. Collator.getAvailableLocales())
333 tagset.add("en-US");
334
335 return tagset;
336 }
337
338 /**
339 * Lazy load available locales.
340 */
341 private static class AvailableJRELocales {
342 private static final Locale[] localeList = createAvailableLocales();
343 private AvailableJRELocales() {
344 }
345 }
346
347 private static Locale[] createAvailableLocales() {
348 /*
349 * Gets the locale string list from LocaleDataMetaInfo class and then
350 * contructs the Locale array and a set of language tags based on the
351 * locale string returned above.
352 */
353 String supportedLocaleString = LocaleDataMetaInfo.getSupportedLocaleString("AvailableLocales");
354
|
312 }
313 }
314 return tagset;
315 }
316
317 protected Set<String> createLanguageTagSet(String category) {
318 String supportedLocaleString = LocaleDataMetaInfo.getSupportedLocaleString(category);
319 Set<String> tagset = new HashSet<>();
320 StringTokenizer tokens = new StringTokenizer(supportedLocaleString);
321 while (tokens.hasMoreTokens()) {
322 String token = tokens.nextToken();
323 if (token.equals("|")) {
324 if (isNonUSLangSupported()) {
325 continue;
326 }
327 break;
328 }
329 tagset.add(token);
330 }
331
332 return tagset;
333 }
334
335 /**
336 * Lazy load available locales.
337 */
338 private static class AvailableJRELocales {
339 private static final Locale[] localeList = createAvailableLocales();
340 private AvailableJRELocales() {
341 }
342 }
343
344 private static Locale[] createAvailableLocales() {
345 /*
346 * Gets the locale string list from LocaleDataMetaInfo class and then
347 * contructs the Locale array and a set of language tags based on the
348 * locale string returned above.
349 */
350 String supportedLocaleString = LocaleDataMetaInfo.getSupportedLocaleString("AvailableLocales");
351
|