Refine search
/** Creates new LocaleIterator for given locale. * @param locale given Locale */ public LocaleIterator(Locale locale) { this.locale = this.initLocale = locale; if (locale.equals(Locale.getDefault())) { defaultInProgress = true; } current = '_' + locale.toString(); if (brandingToken == null) { branding = null; } else { branding = "_" + brandingToken; // NOI18N } //System.err.println("Constructed: " + this); }
String encoding = Locale.getDefault().toString(); if (encoding == null || encoding.length() == 0) { encoding = Locale.ENGLISH.toString(); name = "sofa-rpc/" + filename + "_" + Locale.ENGLISH.toString() + ".properties"; LOG_CODES.put((String) entry.getKey(), (String) entry.getValue()); NOTE = LOG_CODES.get(NOTE_CODE) == null ? "" : LOG_CODES.get(NOTE_CODE); } catch (Exception e) { LOGGER.error("初始化日志码失败:" + name, e);
String encoding = Locale.getDefault().toString(); if (encoding == null || encoding.length() == 0) { encoding = Locale.ENGLISH.toString(); name = "sofa-rpc/" + filename + "_" + Locale.ENGLISH.toString() + ".properties"; LOG_CODES.put((String) entry.getKey(), (String) entry.getValue()); NOTE = LOG_CODES.get(NOTE_CODE) == null ? "" : LOG_CODES.get(NOTE_CODE); } catch (Exception e) { LOGGER.error("初始化日志码失败:" + name, e);
/** * Returns the name of this locale's country, localized to {@code locale}. * Returns the empty string if this locale does not correspond to a specific * country. */ public String getDisplayCountry(Locale locale) { if (countryCode.isEmpty()) { return ""; } String result = ICU.getDisplayCountryNative(toString(), locale.toString()); if (result == null) { // TODO: do we need to do this, or does ICU do it for us? result = ICU.getDisplayCountryNative(toString(), Locale.getDefault().toString()); } return result; }
@Override @Nullable protected MessageFormat resolveCode(String code, Locale locale) { String key = code + '_' + locale.toString(); String msg = this.messages.get(key); if (msg == null) { return null; } synchronized (this.cachedMessageFormats) { MessageFormat messageFormat = this.cachedMessageFormats.get(key); if (messageFormat == null) { messageFormat = createMessageFormat(msg, locale); this.cachedMessageFormats.put(key, messageFormat); } return messageFormat; } }
locale = Locale.getDefault(); ResourceBundle rb = null; if (null == (rb = (ResourceBundle) threadMap.get(locale.toString()))) { rb = ResourceBundle.getBundle("javax.el.PrivateMessages", locale); threadMap.put(locale.toString(), rb);
/** * Returns the full variant name in the specified {@code Locale} for the variant code * of this {@code Locale}. If there is no matching variant name, the variant code is * returned. */ public String getDisplayVariant(Locale locale) { if (variantCode.length() == 0) { return variantCode; } String result = ICU.getDisplayVariantNative(toString(), locale.toString()); if (result == null) { // TODO: do we need to do this, or does ICU do it for us? result = ICU.getDisplayVariantNative(toString(), Locale.getDefault().toString()); } return result; }
@Override @Nullable protected MessageFormat resolveCode(String code, Locale locale) { String key = code + '_' + locale.toString(); String msg = this.messages.get(key); if (msg == null) { return null; } synchronized (this.cachedMessageFormats) { MessageFormat messageFormat = this.cachedMessageFormats.get(key); if (messageFormat == null) { messageFormat = createMessageFormat(msg, locale); this.cachedMessageFormats.put(key, messageFormat); } return messageFormat; } }
dataPairToTableRow( envStrings[ii], environment.get(envStrings[ii]))); String suffix = ""; Locale locale = sortableLocale[ii].getLocale(); if (locale.equals(Locale.getDefault())) { prefix = "<b>"; suffix = "</b>"; locale.toString() + suffix, prefix + getOutputWidgetForContent(sb.toString())); Locale.getDefault(); int border = 5; JPanel p = new JPanel(new BorderLayout()); return locale.toString(); SortableLocale locale2 = (SortableLocale) object2; return locale.toString().compareTo( locale2.toString());
Locale detectLocale(HttpHeaders headers) { final List<Locale> languages; try { languages = headers.getAcceptableLanguages(); } catch (HeaderValueException e) { throw new WebApplicationException(e.getMessage(), Response.Status.BAD_REQUEST); } for (Locale locale : languages) { if (!locale.toString().contains("*")) { // Freemarker doesn't do wildcards well return locale; } } return Locale.getDefault(); }
public static String getPrefixForLocale( Locale locale ) { String localeString = locale.toString().toLowerCase(locale); String result = localePrefixes.get( localeString ); if( result == null ) { result = localePrefixes.get( localeString.substring( 0, 2 ) ); if( result == null ) { Locale parentLocale = new Locale(localeString.substring( 0, 2 )); logger.log( POILogger.ERROR, "Unable to find prefix for " + locale + "(" + locale.getDisplayName(Locale.ROOT) + ") or " + localeString.substring( 0, 2 ) + "(" + parentLocale.getDisplayName(Locale.ROOT) + ")" ); return ""; } } return result; }
private DateTimeFormatter getFormatter(Locale locale) { locale = (locale == null ? Locale.getDefault() : locale); String key = Integer.toString(iType + (iDateStyle << 4) + (iTimeStyle << 8)) + locale.toString(); DateTimeFormatter f = null; synchronized (cCache) { f = cCache.get(key); if (f == null) { String pattern = getPattern(locale); f = DateTimeFormat.forPattern(pattern); cCache.put(key, f); } } return f; }
private static HttpURLConnection createConnection(URL url) throws IOException { HttpURLConnection connection; connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty(USER_AGENT_HEADER, getUserAgent()); connection.setRequestProperty(ACCEPT_LANGUAGE_HEADER, Locale.getDefault().toString()); connection.setChunkedStreamingMode(0); return connection; }
/** * Provides a cached approach for creating NumberFormat instances. More performant * than creating a new one each time. * * @param locale the Locale * @param currency the Currency * @return either a new NumberFormat instance, or one taken from the cache */ public static NumberFormat getNumberFormatFromCache(Locale locale, Currency currency) { String key = locale.toString() + currency.getCurrencyCode(); if (!FORMAT_CACHE.containsKey(key)) { NumberFormat format = NumberFormat.getCurrencyInstance(locale); format.setCurrency(currency); FORMAT_CACHE.put(key, format); } return FORMAT_CACHE.get(key); } }
locale = Locale.getDefault(); ResourceBundle rb = null; if (null == (rb = (ResourceBundle) threadMap.get(locale.toString()))) { rb = ResourceBundle.getBundle("javax.el.PrivateMessages", locale); threadMap.put(locale.toString(), rb);
/** * Returns the name of this locale's language, localized to {@code locale}. * If the language name is unknown, the language code is returned. */ public String getDisplayLanguage(Locale locale) { if (languageCode.isEmpty()) { return ""; } // http://b/8049507 --- frameworks/base should use fil_PH instead of tl_PH. // Until then, we're stuck covering their tracks, making it look like they're // using "fil" when they're not. String localeString = toString(); if (languageCode.equals("tl")) { localeString = toNewString("fil", countryCode, variantCode); } String result = ICU.getDisplayLanguageNative(localeString, locale.toString()); if (result == null) { // TODO: do we need to do this, or does ICU do it for us? result = ICU.getDisplayLanguageNative(localeString, Locale.getDefault().toString()); } return result; }
public static UtilResource getInstance(Locale locale){ if(locale == null){ locale = Locale.getDefault(); } UtilResource res = resouceCache.get(locale.toString()); if(res == null){ res = new UtilResource(locale); resouceCache.put(locale.toString(), res); } return res; }