Package com.ibm.icu.util

Examples of com.ibm.icu.util.ULocale


                Object coll = delegate.createCollator(loc);
                return coll;
            }
               
            public String getDisplayName(String id, ULocale displayLocale) {
                ULocale objectLocale = new ULocale(id);
                return delegate.getDisplayName(objectLocale, displayLocale);
            }

            public Set getSupportedIDs() {
                return delegate.getSupportedLocaleIDs();
View Full Code Here


                Object coll = delegate.createCollator(loc);
                return coll;
            }
               
            public String getDisplayName(String id, ULocale displayLocale) {
                ULocale objectLocale = new ULocale(id);
                return delegate.getDisplayName(objectLocale, displayLocale);
            }
View Full Code Here

    public void TestRoundtrip() {
        ULocale[] locales;
        if (isQuick()) {
            locales = new ULocale[] {
                    new ULocale("bg_BG"),
                    new ULocale("fr_CA"),
                    new ULocale("zh_TW"),
            };
        } else {
            locales = DateFormat.getAvailableULocales();
        }
        long count = locales.length;
View Full Code Here

            !name.equals("GMT+0130") &&
            !name.equals("GMT+130"))
            errln("Fail: Expected GMT+01:30 or something similar");
       
        // cover getDisplayName() - null arg
        ULocale save = ULocale.getDefault();
        ULocale.setDefault(ULocale.US);
        name = zone2.getDisplayName();
        logln("GMT+90min->" + name + "for default display locale");
        if (!name.equals("GMT+01:30") &&
            !name.equals("GMT+1:30") &&
View Full Code Here

        Date now = new Date();

        String[] timezones = {"America/Chicago", "Europe/Moscow", "Europe/Rome", "Asia/Shanghai", "WET" };
        String[] locales = {"en", "fr", "de", "ja", "zh_TW", "zh_Hans" };
        for (int j = 0; j < locales.length; ++j) {
            ULocale locale = new ULocale(locales[j]);
            for (int i = 0; i < timezones.length; ++i) {
                TimeZone tz = TimeZone.getTimeZone(timezones[i]);
                String displayName0 = tz.getDisplayName(locale); // doesn't work???
                SimpleDateFormat dt = new SimpleDateFormat("vvvv", locale);
                dt.setTimeZone(tz);
                String displayName1 = dt.format(now)// date value _does_ matter if we fallback to GMT
                logln(locale.getDisplayName() + ", " + tz.getID() + ": " + displayName0);
                if (!displayName1.equals(displayName0)) {
                    errln(locale.getDisplayName() + ", " + tz.getID() +
                          ": expected " + displayName1 + " but got: " + displayName0);
                }
            }
        }
    }
View Full Code Here

        }
        boolean isICUTimeZone = (TimeZone.getDefaultTimeZoneType() == TimeZone.TIMEZONE_ICU);

        boolean sawAnError = false;
        for (int testNum = 0; testNum < zoneDisplayTestData.length; testNum++) {
            ULocale locale = new ULocale((String)zoneDisplayTestData[testNum][1]);
            TimeZone zone = TimeZone.getTimeZone((String)zoneDisplayTestData[testNum][0]);
            String displayName = zone.getDisplayName(((Boolean)zoneDisplayTestData[testNum][2]).booleanValue(),
                    ((Integer)zoneDisplayTestData[testNum][3]).intValue());
            if (!displayName.equals(zoneDisplayTestData[testNum][4])) {
                if (isReferenceYear
View Full Code Here

            return new int[] {
                UCharacter.getPropertyValueEnum(UProperty.SCRIPT,
                                                nameOrAbbrOrLocale)
            };
        } catch (IllegalArgumentException e) {
            return findCodeFromLocale(new ULocale(nameOrAbbrOrLocale));
        }
    }
View Full Code Here

   *
   * The default is DIN 5007-1, this shows how to tailor a collator to get DIN 5007-2 behavior.
   *  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4423383
   */
  public void testCustomRules() throws Exception {
    RuleBasedCollator baseCollator = (RuleBasedCollator) Collator.getInstance(new ULocale("de_DE"));

    String DIN5007_2_tailorings =
      "& ae , a\u0308 & AE , A\u0308"+
      "& oe , o\u0308 & OE , O\u0308"+
      "& ue , u\u0308 & UE , u\u0308";
View Full Code Here

public class DateTimeFormatCreator {

  private static class DtfiGenerator {

    private static void buildPatterns(GwtLocale locale, TreeMap<Key, String[]> properties) {
      ULocale ulocale = new ULocale(ULocale.canonicalize(locale.getAsString()));
      DateTimePatternGenerator dtpg = DateTimePatternGenerator.getInstance(ulocale);
      for (Map.Entry<String, String> entry : patterns.entrySet()) {
        properties.put(new Key(locale, "format" + entry.getKey()), new String[] {dtpg
            .getBestPattern(entry.getValue())});
      }
View Full Code Here

        }
        catch(DataSourceException e) {
            caught = true;
        }
        assertFalse(caught);
        assertEquals(new ULocale("fr"), dataSourceRequest.getUserLocale());
        assertTrue(dataSourceRequest.isSameOrigin());
        assertEquals(OutputType.CSV, dataSourceRequest.getDataSourceParameters().getOutputType());

        // Test with hl == it, not same-domain.
        dataSourceRequest = null;
        caught = false;
        try {
            HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
            EasyMock.expect(req.getParameter("hl")).andReturn("it");
            EasyMock.expect(req.getHeader("X-DataSource-Auth")).andReturn(null);
            EasyMock.expect(req.getParameter("tqx")).andReturn(null);
            EasyMock.expect(req.getParameter("tq")).andReturn(null);
            EasyMock.replay(req);
            dataSourceRequest = new DataSourceRequest(req);
            EasyMock.verify(req);
        }
        catch(DataSourceException e) {
            caught = true;
        }
        assertFalse(caught);
        assertEquals(new ULocale("it"), dataSourceRequest.getUserLocale());
        assertFalse(dataSourceRequest.isSameOrigin());
        assertEquals(OutputType.JSONP, dataSourceRequest.getDataSourceParameters().getOutputType());
    }
View Full Code Here

TOP

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

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.