Dear ICU team & users,
I would like to propose the following API change for: ICU 78
Please provide feedback by: this Thursday, 2025-08-28
Designated API reviewer: Peter E
Ticket:
https://unicode-org.atlassian.net/browse/ICU-23177
Currently, DateFormatSymbols has a single getter for AM/PM strings. It currently returns the long AM/PM string, but controls the formatting of the abbreviated "a" datetime pattern character.
I would like to add a getter and setter that take a width parameter for the Abbreviated, Wide, and Narrow versions of the AM/PM strings. I propose adding them as overloads on the existing functions.
In C++, dtfmtsym.h:
/**
* Gets AM/PM strings with the specified width. For example: "A" and "P".
* @param count Filled in with length of the array.
* @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
* @return The AM/PM strings. (DateFormatSymbols retains ownership.)
* @draft ICU 78
*/
U_I18N_API const UnicodeString* getAmPmStrings(int32_t& count, DtWidthType width) const;
/**
* Sets AM/PM strings with the specified width. For example: "A" and "P".
* @param ampms The new AM/PM strings. (not adopted; caller retains ownership)
* @param count The number of strings in the array.
* @param width The width of set strings, either WIDE, ABBREVIATED, or NARROW.
* @draft ICU 78
*/
U_I18N_API void setAmPmStrings(const UnicodeString* ampms, int32_t count, DtWidthType width);
Java to follow.
I wanted to send this right away in order to allow for feedback on the shape of the API with at least a whole day for the ICU TC to review it. If anyone or the ICU TC does not wish to accept this change into ICU 78, I will merge a smaller change that only impacts data loading without exposing the public API.
Thanks,
Shane