JDK-7079560 : [Fmt-Da] Context dependent month names support in SimpleDateFormat
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.1.6,1.4.2,5.0,6u10,7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS:
    generic,windows_95,windows_nt,windows_2000,windows_xp,windows_7 generic,windows_95,windows_nt,windows_2000,windows_xp,windows_7
  • CPU: generic,x86
  • Submitted: 2011-08-16
  • Updated: 2017-05-16
  • Resolved: 2012-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b55Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
Context dependent month names need to be supported in SimpleDateFormat. Refer to 4207993 for details.
http://hg.openjdk.java.net/jdk8/tl/jdk/rev/131a683a2ce0

Comments
Run the new test developed for JEP 127 with latest JPRT build and JDK8 b62.
29-10-2012

EVALUATION The following are actual changes in JDK 8. Changes to java.util.Calendar: - Add the following style constants: /** * A style specifier for {@link #getDisplayName(int, int, Locale) * getDisplayName} and {@link #getDisplayNames(int, int, Locale) * getDisplayNames} indicating a short name used for format. * * @see #SHORT_STANDALONE * @see #LONG_FORMAT * @see #LONG_STANDALONE * @since 1.8 */ public static final int SHORT_FORMAT /** * A style specifier for {@link #getDisplayName(int, int, Locale) * getDisplayName} and {@link #getDisplayNames(int, int, Locale) * getDisplayNames} indicating a long name used for format. * * @see #LONG_STANDALONE * @see #SHORT_FORMAT * @see #SHORT_STANDALONE * @since 1.8 */ public static final int LONG_FORMAT /** * A style specifier for {@link #getDisplayName(int, int, Locale) * getDisplayName} and {@link #getDisplayNames(int, int, Locale) * getDisplayNames} indicating a short name used independently, * such as a month abbreviation as calendar headers. * * @see #SHORT_FORMAT * @see #LONG_FORMAT * @see #LONG_STANDALONE * @since 1.8 */ public static final int SHORT_STANDALONE /** * A style specifier for {@link #getDisplayName(int, int, Locale) * getDisplayName} and {@link #getDisplayNames(int, int, Locale) * getDisplayNames} indicating a long name used independently, * such as a month name as calendar headers. * * @see #LONG_FORMAT * @see #SHORT_FORMAT * @see #SHORT_STANDALONE * @since 1.8 */ public static final int LONG_STANDALONE - Change the existing style constants: /** * A style specifier for {@link #getDisplayName(int, int, Locale) * getDisplayName} and {@link #getDisplayNames(int, int, Locale) - * getDisplayNames} indicating a short name, such as "Jan". + * getDisplayNames} equivalent to {@link #SHORT_FORMAT}. * + * @see #SHORT_STANDALONE * @see #LONG * @since 1.6 */ public static final int SHORT /** * A style specifier for {@link #getDisplayName(int, int, Locale) * getDisplayName} and {@link #getDisplayNames(int, int, Locale) - * getDisplayNames} indicating a long name, such as "January". + * getDisplayNames} equivalent to {@link #LONG_FORMAT}. * + * @see #LONG_STANDALONE * @see #SHORT * @since 1.6 */ public static final int LONG - Make the following change to parameter `style' of Calendar.getDisplayName and Calendar.getDisplayNames: * @param style - * the style applied to the string representation; one of - * {@link #SHORT} or {@link #LONG}. + * the style applied to the string representation; one of {@link + * #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE}, + * {@link #LONG_FORMAT} ({@link #LONG}) or {@link #LONG_STANDALONE}. java.text.DateFormatSymbols: - Add the following paragraph to DateFormatSymbols.getMonths(): + * <p>If the language requires different forms for formatting and + * stand-alone usages, this method returns month names in the + * formatting form. For example, the preferred month name for + * January in the Czech language is <em>ledna</em> in the + * formatting form, while it is <em>leden</em> in the stand-alone + * form. This method returns {@code "ledna"} in this case. Refer + * to the <a href="http://unicode.org/reports/tr35/#Calendar_Elements"> + * Calendar Elements in the Unicode Locale Data Markup Language + * (LDML) specification</a> for more details. - Add the following paragraph to DateFormatSymbols.getShortMonths(): + * <p>If the language requires different forms for formatting and + * stand-alone usages, This method returns short month names in + * the formatting form. For example, the preferred abbreviation + * for January in the Catalan language is <em>de gen.</em> in the + * formatting form, while it is <em>gen.</em> in the stand-alone + * form. This method returns {@code "de gen."} in this case. Refer + * to the <a href="http://unicode.org/reports/tr35/#Calendar_Elements"> + * Calendar Elements in the Unicode Locale Data Markup Language + * (LDML) specification</a> for more details. java.text.SimpleDateFormat: - Change the pattern letter 'M' definition: Letter Date or Time Component Presentation Examples ----------------------------------------------------------------------- M Month in year Month July; Jul; 07 to M Month in year (context sensitive) Month July; Jul; 07 - Add new pattern letter 'L': Letter Date or Time Component Presentation Examples ----------------------------------------------------------------------- L Month in year (standalone form) Month July; Jul; 07 - Change the Month presentation: * <li><strong><a name="month">Month:</a></strong> * If the number of pattern letters is 3 or more, the month is * interpreted as <a href="#text">text</a>; otherwise, - * it is interpreted as a <a href="#number">number</a>.<br><br></li> + * it is interpreted as a <a href="#number">number</a>.<br> + * <ul> + * <li>Letter <em>M</em> produces context-sensitive month names, such as the + * embedded form of names. If a {@code DateFormatSymbols} has been set + * explicitly with constructor {@link #SimpleDateFormat(String, + * DateFormatSymbols)} or method {@link + * #setDateFormatSymbols(DateFormatSymbols)}, the month names given by + * the {@code DateFormatSymbols} are used.</li> + * <li>Letter <em>L</em> produces the standalone form of month names.</li> + * </ul> + * <br></li>
29-03-2012

EVALUATION DateFormatSymbols.getMonthNames and getShortMonthNames will also be changed to return names in the format form.
12-03-2012

EVALUATION Calendar.getDisplayName(s) will be utilized to fix this RFE. DateFormatSymbols is kept unchanged for compatibility. SimpleDateFormat will support a new letter for explicitly specify standalone month names. The current month format letter 'M' will be changed to be context dependent.
16-08-2011