This repository was archived by the owner on Jun 8, 2019. It is now read-only.
v1.1.0 — Select Ordinal Support
This release adds support for parsing selectordinal argument types which are the ordinal variant of plural style arguments. The following is an example of how selectordinal arguments could be used:
The elevator is on the {floor, selectordinal,
=0 {ground}
one {#st}
two {#nd}
few {#rd}
other {#th}
} floor.
This would produce the following AST, note the ordinal property on the pluralFormat object:
{
"type": "messageFormatPattern",
"elements": [
{
"type": "messageTextElement",
"value": "The elevator is on the "
},
{
"type": "argumentElement",
"id": "floor",
"format": {
"type": "pluralFormat",
"ordinal": true,
"offset": 0,
"options": [
{
"type": "optionalFormatPattern",
"selector": "=0",
"value": {
"type": "messageFormatPattern",
"elements": [
{
"type": "messageTextElement",
"value": "ground"
}
]
}
},
{
"type": "optionalFormatPattern",
"selector": "one",
"value": {
"type": "messageFormatPattern",
"elements": [
{
"type": "messageTextElement",
"value": "#st"
}
]
}
},
{
"type": "optionalFormatPattern",
"selector": "two",
"value": {
"type": "messageFormatPattern",
"elements": [
{
"type": "messageTextElement",
"value": "#nd"
}
]
}
},
{
"type": "optionalFormatPattern",
"selector": "few",
"value": {
"type": "messageFormatPattern",
"elements": [
{
"type": "messageTextElement",
"value": "#rd"
}
]
}
},
{
"type": "optionalFormatPattern",
"selector": "other",
"value": {
"type": "messageFormatPattern",
"elements": [
{
"type": "messageTextElement",
"value": "#th"
}
]
}
}
]
}
},
{
"type": "messageTextElement",
"value": " floor."
}
]
}