ICU API notice: MF2 allow function overrides

10 views
Skip to first unread message

Steven Loomis

unread,
Jul 3, 2026, 2:35:43 PMJul 3
to icu-d...@unicode.org

Dear ICU team & users,


This is new API for: ICU 79


Ticket: https://unicode-org.atlassian.net/browse/ICU-23424

PR: https://github.com/unicode-org/icu/pull/4041



As part of improving MessageFormat2, this is a semantic change which allows a user-specified function to override a standard function (such as date). There are no API signature changes, however, the apidoc has been updated to reflect this update.


This is C++ only, at this point (and tech preview), but we will work soon on harmonizing the C and J APIs and implementations.


messageformat2_function_registry.h:


class MFFunctionRegistry::Builder

           /**

            * Registers a function to a given name.

            *

            * @param functionName Name of the formatter being registered.

            * @param function A pointer to a Function object.

            *                 This argument is adopted.

            *                 Functions with the same name as standard functions will

            *                 override the standard functions.

            * @param errorCode Input/output error code

            * @return A reference to the builder.

            *

            * @internal ICU 79 technology preview

            * @deprecated This API is for technology preview only.

            */

           Builder& adoptFunction(const data_model::FunctionName& functionName,

                                  Function* function,

                                  UErrorCode& errorCode);


messageformat2.h


class MessageFormat::Builder


           /**

            * Sets a custom function registry.

            *

            * @param functionRegistry Reference to the function registry to use.

            *        `functionRegistry` is not copied,

            *        and the caller must ensure its lifetime contains

            *        the lifetime of the `MessageFormatter` object built by this

            *        builder.

            *        Functions with the same name as standard functions will

            *        override the standard functions.

            * @return       A reference to the builder.

            *

            * @internal ICU 75 technology preview

            * @deprecated This API is for technology preview only.

            */

           U_I18N_API Builder& setFunctionRegistry(const MFFunctionRegistry& functionRegistry);


Thank  you,

Steven



--
Steven R. Loomis
Code Hive Tx, LLC



Markus Scherer

unread,
Jul 3, 2026, 5:05:48 PMJul 3
to Steven Loomis, icu-d...@unicode.org
sgtm tnx
markus
Reply all
Reply to author
Forward
0 new messages