Uploaded image for project: 'ICU'
  1. ICU-9622

Have syntax for MessageFormat with date/time skeletons

    Details

    • Type: Enhancement
    • Status: Done (View workflow)
    • Priority: major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 64.1
    • Component/s: format_message
    • Labels:
      None
    • Time Needed:
      Days
    • tracCc:
      mark,srl
    • tracOwner:
      markus
    • tracProject:
      all
    • tracReporter:
      mark
    • tracStatus:
      accepted
    • tracWeeks:
      0.5

      Description

      To use a message format with a skeleton you have to use some ugly code.

      MessageFormat m = new MessageFormat("... {1,date} ...",uLocale);
            DateTimePatternGenerator dtpg = DateTimePatternGenerator.getInstance(uLocale);
            String pattern2 = dtpg.getBestPattern("jmm"); // need these 2 steps to get from skeleton to pattern
            m.setFormat(1, DateFormat.getPatternInstance(pattern2, uLocale));
      
            m.format(...,now,...)
      

      Would be much easier for callers if we added an option to:

      argType = "number" | "date" | "time" | "spellout" | "ordinal" | "duration"
      

      Something like either "skeleton", or "datetime".

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                mihnita Mihai Nita
                Reporter:
                mark.edward.davis Mark Davis
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  tracCreated: