| 1 |
{ |
| 2 |
"Date and time formats": [ |
| 3 |
{ |
| 4 |
"src": "Expires on {$exp}", |
| 5 |
"exp": "Expires on 8/3/24, 9:43 PM", |
| 6 |
"comment": "Modified from ICU4J copy to add params (likewise with the other date/time tests); 1722746637000 is 2024-08-03 21:43:57 PDT", |
| 7 |
"params": {"exp": { "date": 1722746637000 } } |
| 8 |
}, |
| 9 |
{ |
| 10 |
"src": "Expires on {$exp :datetime}", |
| 11 |
"exp": "Expires on 8/3/24, 9:43 PM", |
| 12 |
"params": {"exp": { "date": 1722746637000 } } |
| 13 |
}, |
| 14 |
{ |
| 15 |
"src": "Expires on {$exp :datetime icu:skeleton=yMMMMdjmsSSEE}", |
| 16 |
"exp": "Expires on Sat, August 3, 2024 at 9:43:57.00 PM", |
| 17 |
"params": {"exp": { "date": 1722746637000 } }, |
| 18 |
"ignoreTest": "ICU-22754 Skeleton option not implemented yet" |
| 19 |
}, |
| 20 |
{ |
| 21 |
"src": "Expires on {$exp :datetime dateStyle=full}", |
| 22 |
"exp": "Expires on Saturday, August 3, 2024", |
| 23 |
"params": {"exp": { "date": 1722746637000 } } |
| 24 |
}, |
| 25 |
{ |
| 26 |
"src": "Expires on {$exp :datetime dateStyle=long}", |
| 27 |
"exp": "Expires on August 3, 2024", |
| 28 |
"params": {"exp": { "date": 1722746637000 } } |
| 29 |
}, |
| 30 |
{ |
| 31 |
"src": "Expires on {$exp :datetime dateStyle=medium}", |
| 32 |
"exp": "Expires on Aug 3, 2024", |
| 33 |
"params": {"exp": { "date": 1722746637000 } } |
| 34 |
}, |
| 35 |
{ |
| 36 |
"src": "Expires on {$exp :datetime timeStyle=long}", |
| 37 |
"exp": "Expires on 9:43:57 PM PDT", |
| 38 |
"params": {"exp": { "date": 1722746637000 } } |
| 39 |
}, |
| 40 |
{ |
| 41 |
"src": "Expires on {$exp :datetime timeStyle=medium}", |
| 42 |
"exp": "Expires on 9:43:57 PM", |
| 43 |
"params": {"exp": { "date": 1722746637000 } } |
| 44 |
}, |
| 45 |
{ |
| 46 |
"src": "Expires on {$exp :datetime timeStyle=short}", |
| 47 |
"exp": "Expires on 9:43 PM", |
| 48 |
"params": {"exp": { "date": 1722746637000 } } |
| 49 |
}, |
| 50 |
{ |
| 51 |
"src": "Expires on {$exp :datetime dateStyle=full timeStyle=medium}", |
| 52 |
"exp": "Expires on Saturday, August 3, 2024 at 9:43:57 PM", |
| 53 |
"params": {"exp": { "date": 1722746637000 } } |
| 54 |
}, |
| 55 |
{ |
| 56 |
"src": "Expires on {$exp :datetime year=numeric month=long}", |
| 57 |
"exp": "Expires on August 2024", |
| 58 |
"params": {"exp": { "date": 1722746637000 } } |
| 59 |
}, |
| 60 |
{ |
| 61 |
"src": "Expires on {$exp :datetime year=numeric month=medium day=numeric weekday=long hour=numeric minute=numeric}", |
| 62 |
"exp": "Expires on 3 Saturday 2024, 9:43 PM", |
| 63 |
"params": {"exp": { "date": 1722746637000 } } |
| 64 |
}, |
| 65 |
{ |
| 66 |
"comment": "Make sure we ignore date / time fields if needed", |
| 67 |
"src": "Expires on {$exp :date year=numeric month=medium day=numeric weekday=long hour=numeric minute=numeric}", |
| 68 |
"exp": "Expires on 3 Saturday 2024", |
| 69 |
"params": {"exp": { "date": 1722746637000 } }, |
| 70 |
"ignoreTest": "ICU-22754 ICU4C doesn't accept field options for `:date` or `:time` -- see spec" |
| 71 |
}, |
| 72 |
{ |
| 73 |
"comment": "Make sure we ignore date / time fields if needed", |
| 74 |
"src": "Expires at {$exp :time year=numeric month=medium day=numeric weekday=long hour=numeric minute=numeric}", |
| 75 |
"exp": "Expires at 9:43 PM", |
| 76 |
"params": {"exp": { "date": 1722746637000 } }, |
| 77 |
"ignoreTest": "ICU-22754 ICU4C doesn't accept field options for `:date` or `:time` -- see spec" |
| 78 |
}, |
| 79 |
{ |
| 80 |
"comment": "Make sure we ignore date / time fields if needed", |
| 81 |
"src": "Expires at {$exp :time style=long dateStyle=full timeStyle=medium}", |
| 82 |
"exp": "Expires at 9:43:57 PM PDT", |
| 83 |
"params": {"exp": { "date": 1722746637000 } } |
| 84 |
}, |
| 85 |
{ |
| 86 |
"comment": "Make sure we ignore date / time fields if needed", |
| 87 |
"src": "Expires on {$exp :date style=long dateStyle=full timeStyle=medium}", |
| 88 |
"exp": "Expires on August 3, 2024", |
| 89 |
"params": {"exp": { "date": 1722746637000 } } |
| 90 |
} |
| 91 |
], |
| 92 |
"Literals" : [ |
| 93 |
{ |
| 94 |
"src": "Expires on {|2025-02-27| :datetime dateStyle=full}", |
| 95 |
"exp": "Expires on Thursday, February 27, 2025" |
| 96 |
}, |
| 97 |
{ |
| 98 |
"src": "Expires at {|2024-07-02T19:23:45| :datetime timeStyle=full}", |
| 99 |
"exp": "Expires at 7:23:45 PM Pacific Daylight Time" |
| 100 |
}, |
| 101 |
{ |
| 102 |
"src": "Expires at {|2024-07-02T19:23:45.123| :datetime timeStyle=full}", |
| 103 |
"exp": "Expires at 7:23:45 PM Pacific Daylight Time" |
| 104 |
}, |
| 105 |
{ |
| 106 |
"src": "Expires on {|2025-02-27T19:23:45| :datetime dateStyle=full}", |
| 107 |
"exp": "Expires on Thursday, February 27, 2025" |
| 108 |
}, |
| 109 |
{ |
| 110 |
"src": "Expires at {|2024-07-02T19:23:45Z| :datetime timeStyle=long}", |
| 111 |
"exp": "Expires at 7:23:45 PM GMT", |
| 112 |
"ignoreTest": "ICU-22754 Time zones not working yet (bug)" |
| 113 |
}, |
| 114 |
{ |
| 115 |
"src": "Expires at {|2024-07-02T19:23:45+03:30| :datetime timeStyle=full}", |
| 116 |
"exp": "Expires at 7:23:45 PM GMT+03:30", |
| 117 |
"ignoreTest": "ICU-22754 Time zones not working yet (bug)" |
| 118 |
} |
| 119 |
], |
| 120 |
"Chaining" : [ |
| 121 |
{ |
| 122 |
"comment": "Horibly long, but I really wanted to test multiple declarations with overrides, and you can't join strings in JSON", |
| 123 |
"srcs": [ |
| 124 |
".input {$exp :datetime timeStyle=short}\n", |
| 125 |
".input {$user :string}\n", |
| 126 |
".local $longExp = {$exp :datetime dateStyle=long}\n", |
| 127 |
".local $zooExp = {$exp :datetime dateStyle=short timeStyle=$tsOver}\n", |
| 128 |
"{{Hello John, you want '{$exp}', '{$longExp}', or '{$zooExp}' or even '{$exp :datetime dateStyle=full}'?}}" |
| 129 |
], |
| 130 |
"exp": "Hello John, you want '9:43 PM', 'August 3, 2024 at 9:43 PM', or '8/3/24, 9:43:57 PM Pacific Daylight Time' or even 'Saturday, August 3, 2024 at 9:43 PM'?", |
| 131 |
"params": {"exp": { "date": 1722746637000 }, "user": "John", "tsOver" : "long" }, |
| 132 |
"ignoreTest": "ICU-22754 ICU4C doesn't implement this kind of function composition yet. See https://github.com/unicode-org/message-format-wg/issues/515" |
| 133 |
}, |
| 134 |
{ |
| 135 |
"srcs": [ |
| 136 |
".input {$exp :datetime year=numeric month=numeric day=|2-digit|}\n", |
| 137 |
".local $longExp = {$exp :datetime month=long weekday=long}\n", |
| 138 |
"{{Expires on '{$exp}' ('{$longExp}').}}" |
| 139 |
], |
| 140 |
"exp": "Expires on '8/03/2024' ('Saturday, August 03, 2024').", |
| 141 |
"params": {"exp": { "date": 1722746637000 } } |
| 142 |
} |
| 143 |
], |
| 144 |
"Number formatter" : [ |
| 145 |
{ |
| 146 |
"src": "Format {$val} number", |
| 147 |
"params": { "val": 31 }, |
| 148 |
"exp": "Format 31 number" |
| 149 |
}, |
| 150 |
{ |
| 151 |
"src": "Format {123456789.9876} number", |
| 152 |
"locale": "en-IN", |
| 153 |
"exp": "Format 12,34,56,789.9876 number", |
| 154 |
"ignoreTest": "ICU-22754 No default formatting for numbers, so it's formatted as a literal string. Is this in the spec?" |
| 155 |
}, |
| 156 |
{ |
| 157 |
"src": "Format {|3.1416|} number", |
| 158 |
"locale": "ar-AR-u-nu-latn", |
| 159 |
"exp": "Format 3.1416 number" |
| 160 |
}, |
| 161 |
{ |
| 162 |
"src": "Format {|3.1416|} number", |
| 163 |
"locale": "ar-AR-u-nu-arab", |
| 164 |
"exp": "Format ٣٫١٤١٦ number", |
| 165 |
"ignoreTest": "ICU-22754 No default formatting for numbers, so it's formatted as a literal string. Is this in the spec?" |
| 166 |
}, |
| 167 |
{ |
| 168 |
"src": "Format {3.1415926 :number}", |
| 169 |
"exp": "Format 3.141593" |
| 170 |
}, |
| 171 |
{ |
| 172 |
"src": "Format {3.1415926 :number maximumFractionDigits=4}", |
| 173 |
"exp": "Format 3.1416" |
| 174 |
}, |
| 175 |
{ |
| 176 |
"src": "Format {3 :number minimumFractionDigits=2}", |
| 177 |
"exp": "Format 3.00" |
| 178 |
}, |
| 179 |
{ |
| 180 |
"src": "Format {3.2 :number minimumFractionDigits=2}", |
| 181 |
"exp": "Format 3.20" |
| 182 |
}, |
| 183 |
{ |
| 184 |
"src": "Format {123456789.97531 :number maximumSignificantDigits=4}", |
| 185 |
"exp": "Format 123,500,000" |
| 186 |
}, |
| 187 |
{ |
| 188 |
"src": "Format {3.1415926 :number}", |
| 189 |
"exp": "Format 3.141593" |
| 190 |
}, |
| 191 |
{ |
| 192 |
"src": "Numbering system {123456 :number numberingSystem=deva}", |
| 193 |
"exp": "Numbering system १२३,४५६" |
| 194 |
}, |
| 195 |
{ |
| 196 |
"src": "Percent {0.1416 :number style=percent}", |
| 197 |
"exp": "Percent 14.16%" |
| 198 |
}, |
| 199 |
{ |
| 200 |
"src": "Scientific {123456789.97531 :number notation=scientific}", |
| 201 |
"exp": "Scientific 1.234568E8" |
| 202 |
}, |
| 203 |
{ |
| 204 |
"src": "Engineering {123456789.97531 :number notation=engineering}", |
| 205 |
"exp": "Engineering 123.45679E6" |
| 206 |
}, |
| 207 |
{ |
| 208 |
"src": "Compact {123456789.97531 :number notation=compact}", |
| 209 |
"exp": "Compact 123M" |
| 210 |
}, |
| 211 |
{ |
| 212 |
"src": "Compact {123456789.97531 :number notation=compact compactDisplay=long}", |
| 213 |
"exp": "Compact 123 million" |
| 214 |
}, |
| 215 |
{ |
| 216 |
"src": "Compact {123456789.97531 :number notation=compact compactDisplay=short}", |
| 217 |
"exp": "Compact 123M" |
| 218 |
} |
| 219 |
] |
| 220 |
} |