Package com.ibm.icu.util

Examples of com.ibm.icu.util.ULocale


   *
   * 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 IValue printDateInLocale(IDateTime inputDate, IString formatString, IString locale)
  //@doc{Print an input date using a specific locale and format string}
  {
    try {
      SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue(),new ULocale(locale.getValue()));
      Calendar cal = getCalendarForDate(inputDate);
      sd.setCalendar(cal);
      return values.string(sd.format(cal.getTime()));
    } catch (IllegalArgumentException iae) {
      throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time with format " + formatString.getValue() + ", in locale: " + locale.getValue(), null, null);
View Full Code Here

  public IValue printDateInLocale(IDateTime inputDate, IString locale)
  //@doc{Print an input date using a specific locale and a default format string}
  {
    try {
      SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd",new ULocale(locale.getValue()));
      Calendar cal = getCalendarForDate(inputDate);
      sd.setCalendar(cal);
      return values.string(sd.format(cal.getTime()));
    } catch (IllegalArgumentException iae) {
      throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time in locale: " + locale.getValue(), null, null);
View Full Code Here

 
  public IValue printTimeInLocale(IDateTime inputTime, IString formatString, IString locale)
  //@doc{Print an input time using a specific locale and format string}
  {
    try {
      SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue(),new ULocale(locale.getValue()));
      Calendar cal = getCalendarForTime(inputTime);
      sd.setCalendar(cal);
      return values.string(sd.format(cal.getTime()));
    } catch (IllegalArgumentException iae) {
      throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time in locale: " + locale.getValue(), null, null);
View Full Code Here

  public IValue printTimeInLocale(IDateTime inputTime, IString locale)
  //@doc{Print an input time using a specific locale and a default format string}
  {
    try {
      SimpleDateFormat sd = new SimpleDateFormat("HH:mm:ss.SSSZ",new ULocale(locale.getValue()));
      Calendar cal = getCalendarForTime(inputTime);
      sd.setCalendar(cal);
      return values.string(sd.format(cal.getTime()));
    } catch (IllegalArgumentException iae) {
      throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print time in locale: " + locale.getValue(), null, null);
View Full Code Here

 
  public IValue printDateTimeInLocale(IDateTime inputDateTime, IString formatString, IString locale)
  //@doc{Print an input datetime using a specific locale and format string}
  {
    try {
      SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue(),new ULocale(locale.getValue()));
      Calendar cal = getCalendarForDateTime(inputDateTime);
      sd.setCalendar(cal);
      return values.string(sd.format(cal.getTime()));
    } catch (IllegalArgumentException iae) {
      throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print datetime using format string: " + formatString.getValue() +
View Full Code Here

  public IValue printDateTimeInLocale(IDateTime inputDateTime, IString locale)
  //@doc{Print an input datetime using a specific locale and a default format string}
  {
    try {
      SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ",new ULocale(locale.getValue()));
      Calendar cal = getCalendarForDateTime(inputDateTime);
      sd.setCalendar(cal);
      return values.string(sd.format(cal.getTime()));
    } catch (IllegalArgumentException iae) {
      throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print datetime in locale: " + locale.getValue(), null, null);
View Full Code Here

    } catch (IOException e) {
      log.error("Couldn't read from url: " + url, e);
      throw new DataSourceException(ReasonType.INVALID_REQUEST, "Couldn't read from url: " + url);
    }
    DataTable dataTable = null;
    ULocale requestLocale = DataSourceHelper.getLocaleFromRequest(request);
    try {
      // Note: We assume that all the columns in the CSV file are text columns. In cases where the
      // column types are known in advance, this behavior can be overridden by passing a list of
      // ColumnDescription objects specifying the column types. See CsvDataSourceHelper.read() for
      // more details.
View Full Code Here

    columnDescriptions.add(new ColumnDescription("B", ValueType.TIMEOFDAY, "B"));
    TimeOfDayValue hindiTimeOfDayValue = new TimeOfDayValue(1, 12, 1);
    String hindiTimeOfDayString =  "\u0966\u0967\u003a\u0967\u0968\u003a\u0966\u0967";
    Reader reader = new StringReader("1," + hindiTimeOfDayString);
    DataTable dataTable = CsvDataSourceHelper.read(reader, columnDescriptions, false,
        new ULocale("hi_IN"));
    assertEquals(1, dataTable.getNumberOfRows());
    assertEquals(2, dataTable.getNumberOfColumns());
    assertEquals(new NumberValue(1), dataTable.getRow(0).getCell(0).getValue());
    assertEquals(hindiTimeOfDayValue, dataTable.getRow(0).getCell(1).getValue());
  }
View Full Code Here

  /*
   * Create a locale from localeID.
   * Then return the appropriate collator for the locale.
   */
  private Collator createFromLocale(String localeID) {
    return Collator.getInstance(new ULocale(localeID));
  }
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.