Skip to content

Discussion tracker: ICU4X "compile time" MessageFormat #6134

@Manishearth

Description

@Manishearth

This issue is a bit of a placeholder for now, but I am filing it to move discussion off of the MF2.o feedback doc.

This issue pertains to the sketch of a design in the MF2.0 ICU4X feedback document under "Compile time API".

The rough design is to have some way of declaring the upper bound of what data a message may need at compile time. The simplest design for this is to include a "source" message that does this.

// Preparses the message
declare_message!(MyMessage, "
.input {$date :datetime weekday=long}
.input {$num :number}
.match $num
 .......
");

let message = MyMessage::new(locale); // loads exactly the data the message needs: here, a weekday=long datetime formatter and plural rules info


// Does not load data
message.format(inputs);

There are i18n problems with this design (programmers should not necessarily be required to understand enough i18n to specify this stuff beforehand), but it can potentially be fixed with the right process/tooling, or by having other ways this data is computed and passed to ICU4X.

@robertbastian had better articulated thoughts around this, with examples. I would like to let him better specify the design, but I'm filing this issue as a place for discussion to be tracked.

cc @hsivonen @zbraniecki @sffc @robertbastian

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-messageComponent: Message, list, textual formattingdiscussDiscuss at a future ICU4X-SC meeting

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions