1
#include "unicode/unistr.h"
2
#include "unicode/msgfmt.h"
3
#include "unicode/calendar.h"
8
// The message format pattern. It takes a single argument, an integer,
9
// and formats it as "no", "one", or a number, using a NumberFormat.
10
static UnicodeString PATTERN(
11
"Received {0,choice,0#no arguments|1#one argument|2#{0,number,integer} arguments}"
15
int main(int argc, char **argv) {
17
UErrorCode status = U_ZERO_ERROR;
21
// Create a message format
22
MessageFormat msg(PATTERN, status);
23
check(status, "MessageFormat::ct");
25
// Create the argument list
26
Formattable msgArgs[2];
27
msgArgs[0].setLong(argc-1);
28
msgArgs[1].setDate(Calendar::getNow());
30
// Format the arguments
31
msg.format(msgArgs, 2, str, pos, status);
32
check(status, "MessageFormat::format");
38
printf("Exiting successfully\n");