java.util.ResourceBundle.getStringArray()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(203)

本文整理了Java中java.util.ResourceBundle.getStringArray方法的一些代码示例,展示了ResourceBundle.getStringArray的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceBundle.getStringArray方法的具体详情如下:
包路径:java.util.ResourceBundle
类名称:ResourceBundle
方法名:getStringArray

ResourceBundle.getStringArray介绍

[英]Returns the named resource from this ResourceBundle.
[中]返回此ResourceBundle中的命名资源。

代码示例

代码示例来源:origin: stackoverflow.com

...
ResourceBundle r = LocaleData.getDateFormatData(loc);
if (!isGregorianCalendar()) {
  try {
    dateTimePatterns = r.getStringArray(getCalendarName() + ".DateTimePatterns");
  } catch (MissingResourceException e) {
  }
}
if (dateTimePatterns == null) {
  dateTimePatterns = r.getStringArray("DateTimePatterns");
}
...

代码示例来源:origin: dufyun/learn-tech-collection

public String[] getStringArray(String key) {
  return rb.getStringArray(key);
}

代码示例来源:origin: dufyun/learn-tech-collection

public String[] getStringArray(String key) {
  return rb.getStringArray(key);
}

代码示例来源:origin: net.sf.mpxj/mpxj

/**
* Convenience method for retrieving a String[] resource.
*
* @param locale locale identifier
* @param key resource key
* @return resource value
*/
public static final String[] getStringArray(Locale locale, String key)
{
 ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
 return (bundle.getStringArray(key));
}

代码示例来源:origin: net.sf.mpxj/mpxj

/**
* Convenience method for retrieving a String[] resource.
*
* @param locale locale identifier
* @param key resource key
* @return resource value
*/
public static final String[] getStringArray(Locale locale, String key)
{
 ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
 return (bundle.getStringArray(key));
}

代码示例来源:origin: joniles/mpxj

/**
* Convenience method for retrieving a String[] resource.
*
* @param locale locale identifier
* @param key resource key
* @return resource value
*/
public static final String[] getStringArray(Locale locale, String key)
{
 ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
 return (bundle.getStringArray(key));
}

代码示例来源:origin: joniles/mpxj

/**
* Convenience method for retrieving a String[] resource.
*
* @param locale locale identifier
* @param key resource key
* @return resource value
*/
public static final String[] getStringArray(Locale locale, String key)
{
 ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
 return (bundle.getStringArray(key));
}

代码示例来源:origin: stackoverflow.com

private void initializeData(Locale desiredLocale) {
  int i;
  ResourceBundle resource = cacheLookup(desiredLocale);

  // FIXME: cache only ResourceBundle. Hence every time, will do
  // getObject(). This won't be necessary if the Resource itself
  // is cached.
  eras = (String[])resource.getObject("Eras");
  months = resource.getStringArray("MonthNames");
  shortMonths = resource.getStringArray("MonthAbbreviations");
  String[] lWeekdays = resource.getStringArray("DayNames");
  weekdays = new String[8];
  weekdays[0] = "";  // 1-based
  for (i=0; i<lWeekdays.length; i++)
    weekdays[i+1] = lWeekdays[i];
  String[] sWeekdays = resource.getStringArray("DayAbbreviations");
  shortWeekdays = new String[8];
  shortWeekdays[0] = "";  // 1-based
/*** start of what causes your odd behaviour **/
  for (i=0; i<sWeekdays.length; i++)
    shortWeekdays[i+1] = sWeekdays[i];
  ampms = resource.getStringArray("AmPmMarkers");
  localPatternChars = resource.getString("DateTimePatternChars");

locale = desiredLocale;
}

代码示例来源:origin: msarhan/ummalqura-calendar

private void initializeData(Locale desiredLocale) {
  if (!("ar".equalsIgnoreCase(desiredLocale.getLanguage()) || "en"
      .equalsIgnoreCase(desiredLocale.getLanguage()))) {
    throw new IllegalArgumentException("Supported locales are 'English' and 'Arabic'");
  }
  locale = desiredLocale;
  // Initialize the fields from the ResourceBundle for locale.
  ResourceBundle resource = ResourceBundle
      .getBundle("com.github.msarhan.ummalqura.calendar.text.UmmalquraFormatData",
          locale);
  months = resource.getStringArray("MonthNames");
  shortMonths = resource.getStringArray("MonthAbbreviations");
}

代码示例来源:origin: msarhan/ummalqura-calendar

private void initializeData(Locale desiredLocale) {
  if (!("ar".equalsIgnoreCase(desiredLocale.getLanguage()) || "en"
      .equalsIgnoreCase(desiredLocale.getLanguage()))) {
    throw new IllegalArgumentException("Supported locales are 'English' and 'Arabic'");
  }
  locale = desiredLocale;
  // Initialize the fields from the ResourceBundle for locale.
  ResourceBundle resource = ResourceBundle
      .getBundle("com.github.msarhan.ummalqura.calendar.text.UmmalquraFormatData",
          locale);
  months = resource.getStringArray("MonthNames");
  shortMonths = resource.getStringArray("MonthAbbreviations");
}

代码示例来源:origin: javax.help/javahelp

static public String[] getStringArray(Locale l, String key) {
ResourceBundle bundle = getBundle(l);
try {
  return bundle.getStringArray(key);
} catch (MissingResourceException ex) {
  throw new Error("Fatal: Localization data for JavaHelp is broken.  Missing "+key+" key.");
}
}

代码示例来源:origin: bcdev/beam

/**
 * Gets the resource strings for the given command command-ID and command property name.
 */
protected String[] getResourceStringArray(ResourceBundle resourceBundle, String commandPropertyName) {
  String key = createResourceKey(commandPropertyName);
  try {
    return resourceBundle.getStringArray(key);
  } catch (MissingResourceException e) {
    //Debug.trace("missing value for resource key '" + key + "'");
    return null;
  }
}

代码示例来源:origin: com.geeoz.atom/atom-api

/**
   * Creates a new ArrayPagingAdapter from external resources.
   *
   * @param bundleName bundle name with resources
   * @param entries    reference to an array resource that will populated
   * @param locale     locate to be used for resources
   * @return an ArrayPagingAdapter with String.
   */
  public static ArrayPagingAdapter<String> createFromResource(
      final String bundleName, final String entries,
      final Locale locale) {
    final ResourceBundle bundle = ResourceBundle.getBundle(
        bundleName, locale,
        Thread.currentThread().getContextClassLoader(),
        ResourceBundleFilter.utf8());
    final String[] strings = bundle.getStringArray(entries);
    return new ArrayPagingAdapter<>(strings);
  }
}

代码示例来源:origin: com.geeoz.atom/atom-api

/**
   * Creates a new ArrayAdapter from external resources.
   *
   * @param bundleName bundle name with resources
   * @param entries    reference to an array resource that will populated
   * @param locale     locate to be used for resources
   * @return an ArrayAdapter with String
   */
  public static ArrayAdapter<String> createFromResource(
      final String bundleName, final String entries,
      final Locale locale) {
    final ResourceBundle bundle = ResourceBundle.getBundle(
        bundleName, locale,
        Thread.currentThread().getContextClassLoader(),
        ResourceBundleFilter.utf8());
    final String[] strings = bundle.getStringArray(entries);
    return new ArrayAdapter<>(strings);
  }
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

dateTimePatterns = r.getStringArray(getCalendarName() + ".DateTimePatterns");
} catch (MissingResourceException e) {
dateTimePatterns = r.getStringArray("DateTimePatterns");

代码示例来源:origin: jtulach/bck2brwsr

dateTimePatterns = r.getStringArray(getCalendarName() + ".DateTimePatterns");
} catch (MissingResourceException e) {
dateTimePatterns = r.getStringArray("DateTimePatterns");

代码示例来源:origin: io.virtdata/virtdata-lib-realer

String[] subres = res.getStringArray(tag.toString());

相关文章