public Preprocess() { super("Preprocess", MaryDataType.TOKENS, MaryDataType.WORDS, Locale.ENGLISH); this.rbnf = new RuleBasedNumberFormat(ULocale.ENGLISH, RuleBasedNumberFormat.SPELLOUT); this.cardinalRule = "%spellout-numbering"; this.ordinalRule = getOrdinalRuleName(rbnf); this.yearRule = getYearRuleName(rbnf); this.df = DateFormat.getDateInstance(DateFormat.LONG, ULocale.ENGLISH); try { this.abbrevMap = loadAbbrevMap(); } catch (IOException e) { e.printStackTrace(); } }
@Override public DateFormat call() throws Exception { return DateFormat.getDateInstance(style, locale); } });
/** * Convenience overload. * @stable ICU 2.0 */ static final public DateFormat getDateInstance(Calendar cal, int dateStyle) { return getDateInstance(cal, dateStyle, ULocale.getDefault(Category.FORMAT)); }
@Override protected String resolve(TemplateContext context) { return DateFormat.getDateInstance().format(new java.util.Date()); } }
/** * Convenience overload. * @stable ICU 2.0 */ static final public DateFormat getDateInstance(Calendar cal, int dateStyle) { return getDateInstance(cal, dateStyle, ULocale.getDefault(Category.FORMAT)); }
@Override protected String resolve(TemplateContext context) { return DateFormat.getDateInstance().format(new java.util.Date()); } }
/** * Creates a {@link DateFormat} object for the default locale that can be used * to format dates in the calendar system specified by <code>cal</code>. * <p> * @param cal The calendar system for which a date format is desired. * * @param dateStyle The type of date format desired. This can be * {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, * etc. * @stable ICU 2.0 */ static final public DateFormat getDateInstance(Calendar cal, int dateStyle) { return getDateInstance(cal, dateStyle, ULocale.getDefault(Category.FORMAT)); }
/** * Creates a {@link DateFormat} object that can be used to format dates in * the calendar system specified by <code>cal</code>. * <p> * @param cal The calendar system for which a date format is desired. * * @param dateStyle The type of date format desired. This can be * {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, * etc. * * @param locale The locale for which the date format is desired. * @stable ICU 3.2 */ static final public DateFormat getDateInstance(Calendar cal, int dateStyle, ULocale locale) { DateFormat df = getDateInstance(dateStyle, locale); df.setCalendar(cal); return df; }
/** * Creates a {@link DateFormat} object that can be used to format dates in * the calendar system specified by <code>cal</code>. * <p> * @param cal The calendar system for which a date format is desired. * * @param dateStyle The type of date format desired. This can be * {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, * etc. * * @param locale The locale for which the date format is desired. * @stable ICU 3.2 */ static final public DateFormat getDateInstance(Calendar cal, int dateStyle, ULocale locale) { DateFormat df = getDateInstance(dateStyle, locale); df.setCalendar(cal); return df; }
/** * Creates a {@link DateFormat} object that can be used to format dates in * the calendar system specified by <code>cal</code>. * <p> * @param cal The calendar system for which a date format is desired. * * @param dateStyle The type of date format desired. This can be * {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, * etc. * * @param locale The locale for which the date format is desired. * @stable ICU 2.0 */ static final public DateFormat getDateInstance(Calendar cal, int dateStyle, Locale locale) { DateFormat df = getDateInstance(dateStyle, locale); df.setCalendar(cal); return df; }
/** * Creates a {@link DateFormat} object that can be used to format dates in * the calendar system specified by <code>cal</code>. * <p> * @param cal The calendar system for which a date format is desired. * * @param dateStyle The type of date format desired. This can be * {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, * etc. * * @param locale The locale for which the date format is desired. * @stable ICU 2.0 */ static final public DateFormat getDateInstance(Calendar cal, int dateStyle, Locale locale) { DateFormat df = getDateInstance(dateStyle, locale); df.setCalendar(cal); return df; }
protected SimpleDateFormat getDateFormat(Locale locale) { SimpleDateFormat dateFormat = null; if (this.variant.equals(DATE)) { //dateFormat = I18nSupport.getInstance().getDateFormat(style, locale); dateFormat = (SimpleDateFormat)DateFormat.getDateInstance(style, locale); } else if (this.variant.equals(TIME)) { //dateFormat = I18nSupport.getInstance().getTimeFormat(style, locale); dateFormat = (SimpleDateFormat)DateFormat.getTimeInstance(style, locale); } else if (this.variant.equals(DATE_TIME)) { //dateFormat = I18nSupport.getInstance().getDateTimeFormat(style, style, locale); dateFormat = (SimpleDateFormat)DateFormat.getDateTimeInstance(style, style, locale); } String pattern = (String)localizedPatterns.get(locale); if (pattern != null) // Note: this was previously using applyLocalizedPattern() which allows to use // a locale-specific pattern syntax, e.g. in french "j" (jour) for "d" and // "a" (annee) for "y". But the localized pattern syntax is very little known and thus // led to some weird pattern syntax error messages. dateFormat.applyPattern(pattern); else if (nonLocalizedPattern != null) dateFormat.applyPattern(nonLocalizedPattern); dateFormat.setLenient(lenient); return dateFormat; }
private DateFormat getInstance(int dstyle, int tstyle, Locale locale) { com.ibm.icu.text.DateFormat icuDfmt; ULocale actual = ICULocaleServiceProvider.toULocaleNoSpecialVariant(locale); if (dstyle == NONE) { icuDfmt = com.ibm.icu.text.DateFormat.getTimeInstance(tstyle, actual); } else if (tstyle == NONE) { icuDfmt = com.ibm.icu.text.DateFormat.getDateInstance(dstyle, actual); } else { icuDfmt = com.ibm.icu.text.DateFormat.getDateTimeInstance(dstyle, tstyle, actual); } if (!(icuDfmt instanceof com.ibm.icu.text.SimpleDateFormat)) { // icuDfmt must be always SimpleDateFormat return null; } return SimpleDateFormatICU.wrap((com.ibm.icu.text.SimpleDateFormat)icuDfmt); } }
/** * {@icu} Returns a <code>DateFormat</code> appropriate to this calendar. * Subclasses wishing to specialize this behavior should override * {@link #handleGetDateFormat}. * @stable ICU 2.0 */ public DateFormat getDateTimeFormat(int dateStyle, int timeStyle, Locale loc) { if (dateStyle != DateFormat.NONE) { if (timeStyle == DateFormat.NONE) { return DateFormat.getDateInstance((Calendar)this.clone(), dateStyle, loc); } else { return DateFormat.getDateTimeInstance((Calendar)this.clone(), dateStyle, timeStyle, loc); } } else if (timeStyle != DateFormat.NONE) { return DateFormat.getTimeInstance((Calendar)this.clone(), timeStyle, loc); } else { return null; } }
/** * {@icu} Returns a <code>DateFormat</code> appropriate to this calendar. * Subclasses wishing to specialize this behavior should override * {@link #handleGetDateFormat}. * @stable ICU 2.0 */ public DateFormat getDateTimeFormat(int dateStyle, int timeStyle, Locale loc) { if (dateStyle != DateFormat.NONE) { if (timeStyle == DateFormat.NONE) { return DateFormat.getDateInstance((Calendar)this.clone(), dateStyle, loc); } else { return DateFormat.getDateTimeInstance((Calendar)this.clone(), dateStyle, timeStyle, loc); } } else if (timeStyle != DateFormat.NONE) { return DateFormat.getTimeInstance((Calendar)this.clone(), timeStyle, loc); } else { return null; } }
private void addICUPatterns(PatternInfo returnInfo, ULocale uLocale) { // first load with the ICU patterns for (int i = DateFormat.FULL; i <= DateFormat.SHORT; ++i) { SimpleDateFormat df = (SimpleDateFormat) DateFormat.getDateInstance(i, uLocale); addPattern(df.toPattern(), false, returnInfo); df = (SimpleDateFormat) DateFormat.getTimeInstance(i, uLocale); addPattern(df.toPattern(), false, returnInfo); if (i == DateFormat.SHORT) { consumeShortTimePattern(df.toPattern(), returnInfo); } } }
DateFormat df = DateFormat.getDateInstance(newStyle, locale); if (df instanceof SimpleDateFormat) { fDateTimeFormat = (SimpleDateFormat)df;
/** * This function can be overridden by subclasses to use different heuristics. * <b>It MUST return a 'safe' value, * one whose modification will not affect this object.</b> * * @param dateStyle * @param timeStyle * @draft ICU 3.6 * @provisional This API might change or be removed in a future release. */ protected DateFormat guessDateFormat(int dateStyle, int timeStyle) { DateFormat result; ULocale dfLocale = getAvailableLocale(TYPE_DATEFORMAT); if (dfLocale == null) { dfLocale = ULocale.ROOT; } if (timeStyle == DF_NONE) { result = DateFormat.getDateInstance(getCalendar(), dateStyle, dfLocale); } else if (dateStyle == DF_NONE) { result = DateFormat.getTimeInstance(getCalendar(), timeStyle, dfLocale); } else { result = DateFormat.getDateTimeInstance(getCalendar(), dateStyle, timeStyle, dfLocale); } return result; }
lastDay= new TreeItem(fEditionTree, SWT.NONE); lastDay.setImage(fDateImage); String df= DateFormat.getDateInstance().format(date); long today= dayNumber(System.currentTimeMillis());
lastDay= new TreeItem(fEditionTree, SWT.NONE); lastDay.setImage(fDateImage); String df= DateFormat.getDateInstance().format(date); long today= dayNumber(System.currentTimeMillis());