Package com.ibm.icu.util

Examples of com.ibm.icu.util.UResourceBundle


   * @see com.ibm.icu.text.TimeZoneNames#getAvailableMetaZoneIDs()
   */
  @Override
  public synchronized Set<String> getAvailableMetaZoneIDs() {
    if (METAZONE_IDS == null) {
      UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones");
      UResourceBundle mapTimezones = bundle.get("mapTimezones");
      Set<String> keys = mapTimezones.keySet();
      METAZONE_IDS = Collections.unmodifiableSet(keys);
    }
    return METAZONE_IDS;
  }
View Full Code Here


     */
    @Override
    protected List<MZMapEntry> createInstance(final String key, final String data) {
      List<MZMapEntry> mzMaps = null;

      UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones");
      UResourceBundle metazoneInfoBundle = bundle.get("metazoneInfo");

      String tzkey = data.replace('/', ':');
      try {
        UResourceBundle zoneBundle = metazoneInfoBundle.get(tzkey);

        mzMaps = new ArrayList<MZMapEntry>(zoneBundle.getSize());
        for (int idx = 0; idx < zoneBundle.getSize(); idx++) {
          UResourceBundle mz = zoneBundle.get(idx);
          String mzid = mz.getString(0);
          String fromStr = "1970-01-01 00:00";
          String toStr = "9999-12-31 23:59";
          if (mz.getSize() == 3) {
            fromStr = mz.getString(1);
            toStr = mz.getString(2);
          }
          long from, to;
          from = parseDate(fromStr);
          to = parseDate(toStr);
          mzMaps.add(new MZMapEntry(mzid, from, to));
View Full Code Here

     */
    @Override
    protected Map<String, String> createInstance(final String key, final String data) {
      Map<String, String> map = null;

      UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, "metaZones");
      UResourceBundle mapTimezones = bundle.get("mapTimezones");

      try {
        UResourceBundle regionMap = mapTimezones.get(key);

        Set<String> regions = regionMap.keySet();
        map = new HashMap<String, String>(regions.size());

        for (String region : regions) {
          String tzID = regionMap.getString(region).intern();
          map.put(region.intern(), tzID);
        }
      } catch (MissingResourceException e) {
        map = Collections.emptyMap();
      }
View Full Code Here

      CapitalizationContextUsage allUsages[] = CapitalizationContextUsage.values();
      for (CapitalizationContextUsage usage : allUsages) {
        capitalizationUsage.put(usage, noTransforms);
      }
      ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, locale);
      UResourceBundle contextTransformsBundle = null;
      try {
        contextTransformsBundle = (UResourceBundle) rb.getWithFallback("contextTransforms");
      } catch (MissingResourceException e) {
        contextTransformsBundle = null; // probably redundant
      }
      if (contextTransformsBundle != null) {
        UResourceBundleIterator ctIterator = contextTransformsBundle.getIterator();
        while (ctIterator.hasNext()) {
          UResourceBundle contextTransformUsage = ctIterator.next();
          int[] intVector = contextTransformUsage.getIntVector();
          if (intVector.length >= 2) {
            String usageKey = contextTransformUsage.getKey();
            CapitalizationContextUsage usage = contextUsageTypeMap.get(usageKey);
            if (usage != null) {
              boolean[] transforms = new boolean[2];
              transforms[0] = (intVector[0] != 0);
              transforms[1] = (intVector[1] != 0);
View Full Code Here

            m_removeSet_.addAll(newSet);
          }
        } else if (optionNumber == 19) {
          int optionEndOffset = rules.indexOf(']', i) + 1;
          ULocale locale = ULocale.forLanguageTag(rules.substring(setStart, optionEndOffset - 1));
          UResourceBundle bundle = UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME + "/coll",
              locale.getBaseName());

          String type = locale.getKeywordValue("collation");
          if (type == null) {
            type = "standard";
          }

          String importRules = bundle.get("collations").get(type).get("Sequence").getString();

          rules = rules.substring(0, i) + importRules + rules.substring(optionEndOffset);
        }
      }
      i++;
View Full Code Here

  private static final boolean DEBUG = ICUDebug.enabled("resourceBundleWrapper");

  // This method is for super class's instantiateBundle method
  public static UResourceBundle getBundleInstance(final String baseName, final String localeID, final ClassLoader root,
      final boolean disableFallback) {
    UResourceBundle b = instantiateBundle(baseName, localeID, root, disableFallback);
    if (b == null) {
      String separator = "_";
      if (baseName.indexOf('/') >= 0) {
        separator = "/";
      }
View Full Code Here

                        init(m_rules_);
                        return;
                    }
                    init();
                    try {
                        UResourceBundle reorderRes = elements.get("%%ReorderCodes");
                        if (reorderRes != null) {
                            int[] reorderCodes = reorderRes.getIntVector();
                            setReorderCodes(reorderCodes);
                            m_defaultReorderCodes_ = reorderCodes.clone();
                        }
                    } catch (MissingResourceException e) {
                        // ignore
View Full Code Here

      resDepth = 0;
      // determine in which locale (if any) the named resource is located
      do {
        try {
          ICUResourceBundle irb = (ICUResourceBundle) r.get(resName);
          UResourceBundle urb = irb.get(kwVal);

          // if we didn't fail before this..
          fullBase = r.getULocale();

          // If the fetched item (urb) is in a different locale than our outer locale (r/fullBase)
          // then we are in a 'fallback' situation. treat as a missing resource situation.
          if (!fullBase.toString().equals(urb.getLocale().toString())) {
            fullBase = null; // fallback condition. Loop and try again.
          }

          // If we fell back to an ancestor of the old 'default',
          // we need to re calculate the "default" keyword.
View Full Code Here

    ULocale locales[] = createULocaleList(baseName, ICU_DATA_CLASS_LOADER);
    int i;

    for (i = 0; i < locales.length; i++) {
      try {
        UResourceBundle b = UResourceBundle.getBundleInstance(baseName, locales[i]);
        // downcast to ICUResourceBundle?
        ICUResourceBundle irb = (ICUResourceBundle) (b.getObject(keyword));
        Enumeration<String> e = irb.getKeys();
        while (e.hasMoreElements()) {
          String s = e.nextElement();
          if (!DEFAULT_TAG.equals(s)) {
            // don't add 'default' items
View Full Code Here

  }

  // This method is for super class's instantiateBundle method
  public static UResourceBundle getBundleInstance(final String baseName, final String localeID, final ClassLoader root,
      final boolean disableFallback) {
    UResourceBundle b = instantiateBundle(baseName, localeID, root, disableFallback);
    if (b == null) {
      throw new MissingResourceException("Could not find the bundle " + baseName + "/" + localeID + ".res", "", "");
    }
    return b;
  }
View Full Code Here

TOP

Related Classes of com.ibm.icu.util.UResourceBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.