ICU4J: MessageFormatter APIs proposed for DRAFT

17 views
Skip to first unread message

Mihai Niță Ⓤ

unread,
Sep 9, 2025, 6:08:25 PMSep 9
to icu-design
Please see below the proposal below, also pasted in the proposal status tracker.

=========

ICU4J: MessageFormatter APIs proposed for DRAFT

MessageFormatter

URL: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4j/index.html?com/ibm/icu/message2/MessageFormatter.html


public class MessageFormatter {

    public static Builder builder();

    public Locale getLocale();

    public ErrorHandlingBehavior getErrorHandlingBehavior();

    public BidiIsolation getBidiIsolation();

    public String getPattern();

    public String formatToString(Map<String, Object> arguments);

    // KEEP TECH PREVIEW, FormattedMessage TBD

    public FormattedMessage format(Map<String, Object> arguments);

    // KEEP TECH PREVIEW, MFDataModel to change

    public MFDataModel.Message getDataModel();


    public static enum ErrorHandlingBehavior {

        BEST_EFFORT,

        STRICT;

    }


    public static enum BidiIsolation {

        NONE,

        DEFAULT;

    }


    public static class Builder {

        // Add setLocale(ULocale) ???

        public Builder setLocale(Locale locale);

        // Take a CharSequence instead ???

        public Builder setPattern(String pattern);

        public Builder setErrorHandlingBehavior(
            ErrorHandlingBehavior errorHandlingBehavior);

        public Builder setBidiIsolation(BidiIsolation bidiIsolation);

        // KEEP TECH PREVIEW, custom functions not final

        public Builder setFunctionRegistry(             MFFunctionRegistry functionRegistry);

        // KEEP TECH PREVIEW, custom functions not final

        public Builder setDataModel(MFDataModel.Message dataModel);

        public MessageFormatter build();

    }

}

Directionality

URL: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4j/com/ibm/icu/message2/Directionality.html

public enum Directionality {

    UNKNOWN,

    LTR,

    RTL,

    AUTO,

    INHERIT;

    public static Directionality of(ULocale ulocale);

}

PlainStringFormattedValue

URL: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4j/com/ibm/icu/message2/PlainStringFormattedValue.html

public class PlainStringFormattedValue implements FormattedValue {

    public PlainStringFormattedValue(String value);

    public int length();

    public char charAt(int index);

    public CharSequence subSequence(int start, int end);

    public <A extends Appendable> A appendTo(A appendable);

    public boolean nextPosition(ConstrainedFieldPosition cfpos);

    public AttributedCharacterIterator toCharacterIterator();

    public String toString();

}


=========

Thank you,
Mihai

Markus Scherer

unread,
Sep 9, 2025, 6:10:14 PMSep 9
to Mihai Niță Ⓤ, icu-design
lgtm tnx -- we will discuss the yellow highlights
Reply all
Reply to author
Forward
0 new messages