@@ -125,21 +125,21 @@ hello.format({ userName: 'Anne' })
125
125
126
126
### Formatting Functions
127
127
128
- A message with an interpolated ` $date ` variable formatted with the ` datetime ` function:
128
+ A message with an interpolated ` $date ` variable formatted with the ` : datetime` function:
129
129
130
- [Today is {$date: datetime weekday=long}.]
130
+ [Today is {$date : datetime weekday=long}.]
131
131
132
132
A message with an interpolated ` $userName ` variable formatted with
133
- the custom ` person ` function capable of
133
+ the custom ` : person` function capable of
134
134
declension (using either a fixed dictionary, algorithmic declension, ML, etc.):
135
135
136
- [Hello, {$userName: person case=vocative}!]
136
+ [Hello, {$userName : person case=vocative}!]
137
137
138
138
A message with an interpolated ` $userObj ` variable formatted with
139
- the custom ` person ` function capable of
139
+ the custom ` : person` function capable of
140
140
plucking the first name from the object representing a person:
141
141
142
- [Hello, {$userObj: person firstName=long}!]
142
+ [Hello, {$userObj : person firstName=long}!]
143
143
144
144
### Markup Elements
145
145
@@ -152,26 +152,26 @@ which the runtime can use to construct a document tree structure for a UI framew
152
152
153
153
A message with a single selector:
154
154
155
- {$count: number}
155
+ {$count : number}
156
156
1 [You have one notification.]
157
157
* [You have {$count} notifications.]
158
158
159
159
A message with a single selector which is an invocation of
160
- a custom function ` platform ` , formatted on a single line:
160
+ a custom function ` : platform` , formatted on a single line:
161
161
162
162
{:platform} windows [Settings] * [Preferences]
163
163
164
- A message with a single selector and a custom ` hasCase ` function
164
+ A message with a single selector and a custom ` : hasCase` function
165
165
which allows the message to query for presence of grammatical cases required for each variant:
166
166
167
- {$userName: hasCase}
168
- vocative [Hello, {$userName: person case=vocative}!]
169
- accusative [Please welcome {$userName: person case=accusative}!]
167
+ {$userName : hasCase}
168
+ vocative [Hello, {$userName : person case=vocative}!]
169
+ accusative [Please welcome {$userName : person case=accusative}!]
170
170
* [Hello!]
171
171
172
172
A message with 2 selectors:
173
173
174
- {$photoCount: number} {$userGender: equals}
174
+ {$photoCount : number} {$userGender : equals}
175
175
1 masculine [{$userName} added a new photo to his album.]
176
176
1 feminine [{$userName} added a new photo to her album.]
177
177
1 * [{$userName} added a new photo to their album.]
@@ -183,27 +183,27 @@ A message with 2 selectors:
183
183
184
184
A message defining a local variable ` $whom ` which is then used twice inside the pattern:
185
185
186
- $whom = {$monster: noun case=accusative}
187
- [You see {$quality: adjective article=indefinite accord=$whom} {$whom}!]
186
+ $whom = {$monster : noun case=accusative}
187
+ [You see {$quality : adjective article=indefinite accord=$whom} {$whom}!]
188
188
189
189
A message defining two local variables:
190
190
` $itemAcc ` and ` $countInt ` , and using ` $countInt ` as a selector:
191
191
192
- $countInt = {$count: number maximumFractionDigits=0}
193
- $itemAcc = {$item: noun count=$count case=accusative}
194
- one [You bought {$color: adjective article=indefinite accord=$itemAcc} {$itemAcc}.]
195
- * [You bought {$countInt} {$color: adjective accord=$itemAcc} {$itemAcc}.]
192
+ $countInt = {$count : number maximumFractionDigits=0}
193
+ $itemAcc = {$item : noun count=$count case=accusative}
194
+ one [You bought {$color : adjective article=indefinite accord=$itemAcc} {$itemAcc}.]
195
+ * [You bought {$countInt} {$color : adjective accord=$itemAcc} {$itemAcc}.]
196
196
197
197
### Complex Messages
198
198
199
199
A complex message with 2 selectors and 3 local variable definitions:
200
200
201
- {$host: gender}
202
- {$guestOther: number}
201
+ {$host : gender}
202
+ {$guestOther : number}
203
203
204
- $hostName = {$host: person firstName=long}
205
- $guestName = {$guest: person firstName=long}
206
- $guestsOther = {$guestCount: number offset=1}
204
+ $hostName = {$host : person firstName=long}
205
+ $guestName = {$guest : person firstName=long}
206
+ $guestsOther = {$guestCount : number offset=1}
207
207
208
208
female 0 [{$hostName} does not give a party.]
209
209
female 1 [{$hostName} invites {$guestName} to her party.]
@@ -338,7 +338,7 @@ Standalone function calls don't have any operands in front of them.
338
338
``` ebnf
339
339
Expression ::= Operand Annotation? | Annotation
340
340
Operand ::= String | Variable
341
- Annotation ::= ':' Name Option*
341
+ Annotation ::= Function Option*
342
342
Option ::= Name '=' (String | Nmtoken | Variable)
343
343
```
344
344
@@ -349,19 +349,19 @@ Examples:
349
349
```
350
350
351
351
```
352
- "1.23": number maxFractionDigits=1
352
+ "1.23" : number maxFractionDigits=1
353
353
```
354
354
355
355
```
356
- "1970-01-01T13:37:00.000Z": datetime weekday=long
356
+ "1970-01-01T13:37:00.000Z" : datetime weekday=long
357
357
```
358
358
359
359
```
360
- "Thu Jan 01 1970 14:37:00 GMT+0100 (CET)": datetime weekday=long
360
+ "Thu Jan 01 1970 14:37:00 GMT+0100 (CET)" : datetime weekday=long
361
361
```
362
362
363
363
```
364
- $when: datetime month=2-digit
364
+ $when : datetime month=2-digit
365
365
```
366
366
367
367
```
@@ -412,7 +412,7 @@ AnyChar ::= .
412
412
### Names
413
413
414
414
The _ name_ token is used for variable names (prefixed with ` $ ` ),
415
- function names as well as option names.
415
+ function names (prefixed with ` : ` ) as well as option names.
416
416
A name cannot start with an ASCII digit and certain basic combining characters.
417
417
Otherwise, the set of characters allowed in names is large.
418
418
@@ -428,6 +428,7 @@ uses Nmtokens.
428
428
429
429
``` ebnf
430
430
Variable ::= '$' Name /* ws: explicit */
431
+ Function ::= ':' Name /* ws: explicit */
431
432
Name ::= NameStart NameChar* /* ws: explicit */
432
433
Nmtoken ::= NameChar+ /* ws: explicit */
433
434
NameStart ::= [a-zA-Z] | "_"
0 commit comments