Package com.ibm.icu.text

Examples of com.ibm.icu.text.MessageFormat


    String pattern = langData.get("localeDisplayPattern", "pattern");
    if ("pattern".equals(pattern)) {
      pattern = "{0} ({1})";
    }
    this.format = new MessageFormat(pattern);

    String keyTypePattern = langData.get("localeDisplayPattern", "keyTypePattern");
    if ("keyTypePattern".equals(keyTypePattern)) {
      keyTypePattern = "{0}={1}";
    }
    this.keyTypeFormat = new MessageFormat(keyTypePattern);

    // Get values from the contextTransforms data
    // (copied from DateFormatSymbols)
    if (capitalization == DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU
        || capitalization == DisplayContext.CAPITALIZATION_FOR_STANDALONE) {
View Full Code Here


        pattern = patterns[glueIndex];
      }
    } catch (MissingResourceException e) {
      // use default
    }
    fCombinedFormat = new MessageFormat(pattern, locale);
    return fCombinedFormat;
  }
View Full Code Here

                pattern = patterns[glueIndex];
            }
        } catch (MissingResourceException e) {
            // use default
        }
        fCombinedFormat = new MessageFormat(pattern, locale);
        return fCombinedFormat;
    }
View Full Code Here

        if (getSingleCountry(tzid) != null) { // single country
            String regPat = getTZLocalizationInfo(locale, REGION_FORMAT);
            if (regPat == null) {
                regPat = DEF_REGION_FORMAT;
            }
            MessageFormat mf = new MessageFormat(regPat);
            return mf.format(new Object[] { country });
        }

        if (city == null) {
            city = tzid.substring(tzid.lastIndexOf('/')+1).replace('_',' ');
        }

        String flbPat = getTZLocalizationInfo(locale, FALLBACK_FORMAT);
        if (flbPat == null) {
            flbPat = DEF_FALLBACK_FORMAT;
        }
        MessageFormat mf = new MessageFormat(flbPat);

        return mf.format(new Object[] { city, country });
    }
View Full Code Here

    private static MessageFormat getFallbackFormat(ULocale locale) {
        String fallbackPattern = ZoneMeta.getTZLocalizationInfo(locale, ZoneMeta.FALLBACK_FORMAT);
        if (fallbackPattern == null) {
            fallbackPattern = "{1} ({0})";
        }
        return new MessageFormat(fallbackPattern, locale);
    }
View Full Code Here

    private static MessageFormat getRegionFormat(ULocale locale) {
        String regionPattern = ZoneMeta.getTZLocalizationInfo(locale, ZoneMeta.REGION_FORMAT);
        if (regionPattern == null) {
            regionPattern = "{0}";
        }
        return new MessageFormat(regionPattern, locale);
    }
View Full Code Here

        String pattern = langData.get("localeDisplayPattern", "pattern");
        if ("pattern".equals(pattern)) {
            pattern = "{0} ({1})";
        }
        this.format = new MessageFormat(pattern);
    }
View Full Code Here

                pattern = patterns[8];
            }
        } catch (MissingResourceException e) {
            // use default
        }
        fCombinedFormat = new MessageFormat(pattern, locale);
        return fCombinedFormat;
    }
View Full Code Here

        if (getSingleCountry(tzid) != null) { // single country
            String regPat = getTZLocalizationInfo(locale, REGION_FORMAT);
            if (regPat == null) {
                regPat = DEF_REGION_FORMAT;
            }
            MessageFormat mf = new MessageFormat(regPat);
            return mf.format(new Object[] { country });
        }

        if (city == null) {
            city = tzid.substring(tzid.lastIndexOf('/')+1).replace('_',' ');
        }

        String flbPat = getTZLocalizationInfo(locale, FALLBACK_FORMAT);
        if (flbPat == null) {
            flbPat = DEF_FALLBACK_FORMAT;
        }
        MessageFormat mf = new MessageFormat(flbPat);

        return mf.format(new Object[] { city, country });
    }
View Full Code Here

            // because generic location format is generated from tzid for the case.
            // The rest of code should work even zoneStrings is null.
        }

        String[] zoneIDs = TimeZone.getAvailableIDs();
        MessageFormat fallbackFmt = getFallbackFormat(locale);
        MessageFormat regionFmt = getRegionFormat(locale);

        String[] zstrarray = new String[ZSIDX_MAX];
        String[] mzstrarray = new String[ZSIDX_MAX];
        String[][] mzPartialLoc = new String[10][4]; // maximum 10 metazones per zone

        for (int i = 0; i < zoneIDs.length; i++) {
            // Skip aliases
            String tzid = ZoneMeta.getCanonicalSystemID(zoneIDs[i]);
            if (tzid == null || !zoneIDs[i].equals(tzid)) {
                continue;
            }

            String zoneKey = tzid.replace('/', ':');
            zstrarray[ZSIDX_LONG_STANDARD] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_LONG_STANDARD);
            zstrarray[ZSIDX_SHORT_STANDARD] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_SHORT_STANDARD);
            zstrarray[ZSIDX_LONG_DAYLIGHT] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_LONG_DAYLIGHT);
            zstrarray[ZSIDX_SHORT_DAYLIGHT] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_SHORT_DAYLIGHT);
            zstrarray[ZSIDX_LONG_GENERIC] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_LONG_GENERIC);
            zstrarray[ZSIDX_SHORT_GENERIC] = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_SHORT_GENERIC);

            // Compose location format string
            String countryCode = ZoneMeta.getCanonicalCountry(tzid);
            String country = null;
            String city = null;
            if (countryCode != null) {
                city = getZoneStringFromBundle(zoneStringsBundle, zoneKey, RESKEY_EXEMPLAR_CITY);
                if (city == null) {
                    city = tzid.substring(tzid.lastIndexOf('/') + 1).replace('_', ' ');
                }
                country = getLocalizedCountry(countryCode, locale);
                if (ZoneMeta.getSingleCountry(tzid) != null) {
                    // If the zone is only one zone in the country, do not add city
                    zstrarray[ZSIDX_LOCATION] = regionFmt.format(new Object[] {country});
                } else {
                    zstrarray[ZSIDX_LOCATION] = fallbackFmt.format(new Object[] {city, country});
                }
            } else {
                zstrarray[ZSIDX_LOCATION] = null;
View Full Code Here

TOP

Related Classes of com.ibm.icu.text.MessageFormat

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.