sun.util.locale.provider.LocaleDataMetaInfo Java Examples
The following examples show how to use
sun.util.locale.provider.LocaleDataMetaInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CLDRLocaleProviderAdapter.java From Bytecoder with Apache License 2.0 | 6 votes |
public CLDRLocaleProviderAdapter() { LocaleDataMetaInfo nbmi = null; try { nbmi = AccessController.doPrivileged(new PrivilegedExceptionAction<LocaleDataMetaInfo>() { @Override public LocaleDataMetaInfo run() { for (LocaleDataMetaInfo ldmi : ServiceLoader.loadInstalled(LocaleDataMetaInfo.class)) { if (ldmi.getType() == LocaleProviderAdapter.Type.CLDR) { return ldmi; } } return null; } }); } catch (PrivilegedActionException pae) { throw new InternalError(pae.getCause()); } nonBaseMetaInfo = nbmi; }
Example #2
Source File: CLDRLocaleProviderAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public CLDRLocaleProviderAdapter() { LocaleDataMetaInfo nbmi = null; try { nbmi = AccessController.doPrivileged(new PrivilegedExceptionAction<LocaleDataMetaInfo>() { @Override public LocaleDataMetaInfo run() { for (LocaleDataMetaInfo ldmi : ServiceLoader.loadInstalled(LocaleDataMetaInfo.class)) { if (ldmi.getType() == LocaleProviderAdapter.Type.CLDR) { return ldmi; } } return null; } }); } catch (Exception e) { // Catch any exception, and continue as if only CLDR's base locales exist. } nonBaseMetaInfo = nbmi; }
Example #3
Source File: LocaleData.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public List<Locale> getCandidateLocales(String baseName, Locale locale) { List<Locale> candidates = super.getCandidateLocales(baseName, locale); /* Get the locale string list from LocaleDataMetaInfo class. */ String localeString = LocaleDataMetaInfo.getSupportedLocaleString(baseName); if (localeString != null && localeString.length() != 0) { for (Iterator<Locale> l = candidates.iterator(); l.hasNext();) { Locale loc = l.next(); String lstr; if (loc.getScript().length() > 0) { lstr = loc.toLanguageTag().replace('-', '_'); } else { lstr = loc.toString(); int idx = lstr.indexOf("_#"); if (idx >= 0) { lstr = lstr.substring(0, idx); } } /* Every locale string in the locale string list returned from the above getSupportedLocaleString is enclosed within two white spaces so that we could check some locale such as "en". */ if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) { l.remove(); } } } // Force fallback to Locale.ENGLISH for CLDR time zone names support if (locale.getLanguage() != "en" && baseName.contains(CLDR) && baseName.endsWith("TimeZoneNames")) { candidates.add(candidates.size() - 1, Locale.ENGLISH); } return candidates; }
Example #4
Source File: LocaleData.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public List<Locale> getCandidateLocales(String baseName, Locale locale) { List<Locale> candidates = super.getCandidateLocales(baseName, locale); /* Get the locale string list from LocaleDataMetaInfo class. */ String localeString = LocaleDataMetaInfo.getSupportedLocaleString(baseName); if (localeString != null && localeString.length() != 0) { for (Iterator<Locale> l = candidates.iterator(); l.hasNext();) { Locale loc = l.next(); String lstr; if (loc.getScript().length() > 0) { lstr = loc.toLanguageTag().replace('-', '_'); } else { lstr = loc.toString(); int idx = lstr.indexOf("_#"); if (idx >= 0) { lstr = lstr.substring(0, idx); } } /* Every locale string in the locale string list returned from the above getSupportedLocaleString is enclosed within two white spaces so that we could check some locale such as "en". */ if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) { l.remove(); } } } // Force fallback to Locale.ENGLISH for CLDR time zone names support if (locale.getLanguage() != "en" && baseName.contains(CLDR) && baseName.endsWith("TimeZoneNames")) { candidates.add(candidates.size() - 1, Locale.ENGLISH); } return candidates; }
Example #5
Source File: LocaleData.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public List<Locale> getCandidateLocales(String baseName, Locale locale) { List<Locale> candidates = super.getCandidateLocales(baseName, locale); /* Get the locale string list from LocaleDataMetaInfo class. */ String localeString = LocaleDataMetaInfo.getSupportedLocaleString(baseName); if (localeString != null && localeString.length() != 0) { for (Iterator<Locale> l = candidates.iterator(); l.hasNext();) { Locale loc = l.next(); String lstr; if (loc.getScript().length() > 0) { lstr = loc.toLanguageTag().replace('-', '_'); } else { lstr = loc.toString(); int idx = lstr.indexOf("_#"); if (idx >= 0) { lstr = lstr.substring(0, idx); } } /* Every locale string in the locale string list returned from the above getSupportedLocaleString is enclosed within two white spaces so that we could check some locale such as "en". */ if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) { l.remove(); } } } // Force fallback to Locale.ENGLISH for CLDR time zone names support if (locale.getLanguage() != "en" && baseName.contains(CLDR) && baseName.endsWith("TimeZoneNames")) { candidates.add(candidates.size() - 1, Locale.ENGLISH); } return candidates; }
Example #6
Source File: LocaleData.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override public List<Locale> getCandidateLocales(String baseName, Locale locale) { List<Locale> candidates = super.getCandidateLocales(baseName, locale); /* Get the locale string list from LocaleDataMetaInfo class. */ String localeString = LocaleDataMetaInfo.getSupportedLocaleString(baseName); if (localeString != null && localeString.length() != 0) { for (Iterator<Locale> l = candidates.iterator(); l.hasNext();) { Locale loc = l.next(); String lstr; if (loc.getScript().length() > 0) { lstr = loc.toLanguageTag().replace('-', '_'); } else { lstr = loc.toString(); int idx = lstr.indexOf("_#"); if (idx >= 0) { lstr = lstr.substring(0, idx); } } /* Every locale string in the locale string list returned from the above getSupportedLocaleString is enclosed within two white spaces so that we could check some locale such as "en". */ if (lstr.length() != 0 && localeString.indexOf(" " + lstr + " ") == -1) { l.remove(); } } } // Force fallback to Locale.ENGLISH for CLDR time zone names support if (locale.getLanguage() != "en" && baseName.contains(CLDR) && baseName.endsWith("TimeZoneNames")) { candidates.add(candidates.size() - 1, Locale.ENGLISH); } return candidates; }