private ResourceBundle loadResources(Locale locale) { try { return ResourceBundle.getBundle(targetPackageClass.getPackage().getName() + "." + shortName, locale); } catch (MissingResourceException e) { return null; } }
public static ResourceBundle getBundle(string baseName, Locale locale) { if (ResourceBundleWrapper.noCodeBaseClassLoader != null) return ResourceBundle.getBundle(baseName, locale, (ClassLoader) ResourceBundleWrapper.noCodeBaseClassLoader); else return ResourceBundle.getBundle(baseName, locale, ResourceBundleWrapper.__\u003CGetCallerID\u003E()); }
private synchronized ResourceBundle getResourceBundle(Locale locale) { var result = resourceBundles.get(locale); if (result == null) { result = loadResources(locale); if (result != null) { resourceBundles.put(locale, result); } } return result; }
public String getMessage(Locale locale, String key, params Object[] args) { var rb = getResourceBundle(locale); if (rb != null) { try { return MessageFormat.format(rb.getString(key), args); } catch { } } return key; }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is an <code>Integer</code> return its integer value, otherwise return 0. /// </summary> public int getInt(object @key, Locale @l) { return default(int); }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is an <code>Insets</code> return it, otherwise return <code>null</code>. /// </summary> public Insets getInsets(object @key, Locale @l) { return default(Insets); }
/// <summary> /// Gets a calendar with the specified time zone and locale. /// </summary> public static Calendar getInstance(TimeZone zone, Locale aLocale) { return default(Calendar); }
/** * As per {@link #getDescriptionForValidNumber(PhoneNumber, Locale)} but also considers the * region of the user. If the phone number is from the same region as the user, only a lower-level * description will be returned, if one exists. Otherwise, the phone number's region will be * returned, with optionally some more detailed information. * * <p>For example, for a user from the region "US" (United States), we would show "Mountain View, * CA" for a particular number, omitting the United States from the description. For a user from * the United Kingdom (region "GB"), for the same number we may show "Mountain View, CA, United * States" or even just "United States". * * <p>This method assumes the validity of the number passed in has already been checked. * * @param number the phone number for which we want to get a text description * @param languageCode the language code for which the description should be written * @param userRegion the region code for a given user. This region will be omitted from the * description if the phone number comes from this region. It is a two-letter uppercase ISO * country code as defined by ISO 3166-1. * @return a text description for the given language code for the given phone number, or empty * string if the number passed in is invalid */ public String getDescriptionForValidNumber(PhoneNumber number, Locale languageCode, String userRegion) { // If the user region matches the number's region, then we just show the lower-level // description, if one exists - if no description exists, we will show the region(country) name // for the number. String regionCode = phoneUtil.getRegionCodeForNumber(number); if (userRegion.equals(regionCode)) { return getDescriptionForValidNumber(number, languageCode); } // Otherwise, we just show the region(country) name for now. return getRegionDisplayName(regionCode, languageCode); // TODO: Concatenate the lower-level and country-name information in an appropriate // way for each language. }
/// <summary> /// Sets the default locale used to initialize each JComponent's locale /// property upon creation. /// </summary> static public void setDefaultLocale(Locale @l) { }
public static string getDisplayLanguageForLocaleCode(string code) { Locale locale = new Locale(code); return locale.getDisplayLanguage(); }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is boolean, return the boolean value, otherwise return false. /// </summary> public bool getBoolean(object @key, Locale @l) { return default(bool); }
/// <summary> /// Gets the date formatter with the given formatting style for the given locale. /// </summary> public static DateFormat getDateInstance(int style, Locale aLocale) { return default(DateFormat); }
/// <summary> /// Gets the date/time formatter with the given formatting styles for the given locale. /// </summary> public static DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) { return default(DateFormat); }
/// <summary> /// Converts all of the characters in this <code>String</code> to upper /// case using the rules of the given <code>Locale</code>. /// </summary> public string toUpperCase(Locale @locale) { return default(string); }
/** * Returns the customary display name in the given language for the given region. */ private String getRegionDisplayName(String regionCode, Locale language) { return (regionCode == null || regionCode.equals("ZZ") || regionCode.equals(PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY)) ? "" : new Locale("", regionCode).getDisplayCountry(language); }
/** * Returns the customary display name in the given language for the given territory the phone * number is from. */ private String getCountryNameForNumber(PhoneNumber number, Locale language) { String regionCode = phoneUtil.getRegionCodeForNumber(number); return getRegionDisplayName(regionCode, language); }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is a <code>String</code> return it, otherwise return <code>null</code>. /// </summary> public string getString(object @key, Locale @l) { return default(string); }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is a <code>Border</code> return it, otherwise return <code>null</code>. /// </summary> public Border getBorder(object @key, Locale @l) { return default(Border); }
/// <summary> /// Returns the value for key associated with the given locale. /// </summary> public object get(object @key, Locale @l) { return default(object); }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is a <code>Color</code> return it, otherwise return <code>null</code>. /// </summary> public Color getColor(object @key, Locale @l) { return default(Color); }
/// <summary> /// Returns the orientation that is appropriate for the given locale. /// </summary> public ComponentOrientation getOrientation(Locale @locale) { return default(ComponentOrientation); }
/** * As per {@link #getDescriptionForValidNumber(PhoneNumber, Locale, String)} but * explicitly checks the validity of the number passed in. * * @param number the phone number for which we want to get a text description * @param languageCode the language code for which the description should be written * @param userRegion the region code for a given user. This region will be omitted from the * description if the phone number comes from this region. It is a two-letter uppercase ISO * country code as defined by ISO 3166-1. * @return a text description for the given language code for the given phone number, or empty * string if the number passed in is invalid */ public String getDescriptionForNumber(PhoneNumber number, Locale languageCode, String userRegion) { PhoneNumberType numberType = phoneUtil.getNumberType(number); if (numberType == PhoneNumberType.UNKNOWN) { return ""; } else if (!canBeGeocoded(numberType)) { return getCountryNameForNumber(number, languageCode); } return getDescriptionForValidNumber(number, languageCode, userRegion); }
/// <summary> /// Sets the locale of this component. /// </summary> public void setLocale(Locale @l) { }
/// <summary> /// Returns a name of this time zone suitable for presentation to the user in the specified locale. /// </summary> public string getDisplayName(Locale locale) { return default(string); }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is a <code>Dimension</code> return it, otherwise return <code>null</code>. /// </summary> public Dimension getDimension(object @key, Locale @l) { return default(Dimension); }
/** * Returns a text description for the given phone number, in the language provided. The * description might consist of the name of the country where the phone number is from, or the * name of the geographical area the phone number is from if more detailed information is * available. * * <p>This method assumes the validity of the number passed in has already been checked, and that * the number is suitable for geocoding. We consider fixed-line and mobile numbers possible * candidates for geocoding. * * @param number a valid phone number for which we want to get a text description * @param languageCode the language code for which the description should be written * @return a text description for the given language code for the given phone number */ public String getDescriptionForValidNumber(PhoneNumber number, Locale languageCode) { String langStr = languageCode.getLanguage(); String scriptStr = ""; // No script is specified String regionStr = languageCode.getCountry(); String areaDescription = getAreaDescriptionForNumber(number, langStr, scriptStr, regionStr); return (areaDescription.length() > 0) ? areaDescription : getCountryNameForNumber(number, languageCode); }
/// <summary> /// Returns a name of this time zone suitable for presentation to the user in the specified locale. /// </summary> public string getDisplayName(bool daylight, int style, Locale locale) { return default(string); }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is a <code>Font</code> return it, otherwise return <code>null</code>. /// </summary> public Font getFont(object @key, Locale @l) { return default(Font); }
/// <summary> /// Attempts to select an input method or keyboard layout that /// supports the given locale, and returns a value indicating whether such /// an input method or keyboard layout has been successfully selected. /// </summary> public bool selectInputMethod(Locale @locale) { return default(bool); }
/// <summary> /// If the value of <code>key</code> for the given <code>Locale</code> /// is an <code>Icon</code> return it, otherwise return <code>null</code>. /// </summary> public Icon getIcon(object @key, Locale @l) { return default(Icon); }