|
| 1 | +# Design Proposal Template |
| 2 | + |
| 3 | +<details> |
| 4 | + <summary>Metadata</summary> |
| 5 | + <dl> |
| 6 | + <dt>Contributors</dt> |
| 7 | + <dd>@username</dd> |
| 8 | + <dt>First proposed</dt> |
| 9 | + <dd>1970-01-01</dd> |
| 10 | + <dt>Pull Request</dt> |
| 11 | + <dd>#000</dd> |
| 12 | + </dl> |
| 13 | +</details> |
| 14 | + |
| 15 | +## Objective |
| 16 | + |
| 17 | +*What is this proposal trying to achieve?* |
| 18 | + |
| 19 | +Decide how to interpolate data in patterns, in order to be able to display dynamic information like numbers, dates, and names inside translatable messages. |
| 20 | + |
| 21 | +## Background |
| 22 | + |
| 23 | +*What context is helpful to understand this proposal?* |
| 24 | + |
| 25 | +Translatable messages need to interpolate data... |
| 26 | +Such data must be formatted and positioned inside translation patterns... |
| 27 | +There's prior art in other translation and templating solutions... |
| 28 | + |
| 29 | +## Use-Cases |
| 30 | + |
| 31 | +*What use-cases do we see? Ideally, quote concrete examples.* |
| 32 | + |
| 33 | +* Numbers representing counts, e.g. `{You have {$count} new messages}`... |
| 34 | +* Strings representing usernames, e.g. `{Hello, {$userName}!}`... |
| 35 | +* Selection based on numbers, e.g. `match {$count} when 1 {One thing} when * {Many things}`... |
| 36 | + |
| 37 | +## Requirements |
| 38 | + |
| 39 | +*What properties does the solution have to manifest to enable the use-cases above?* |
| 40 | + |
| 41 | +* Be able to use a variable more than once in a pattern... |
| 42 | +* Be able to use a variable in a selector... |
| 43 | +* Be able to reorder a variable... |
| 44 | +* Be able to tell what a variable refers to... |
| 45 | +* Make migration from ICU MF1 possible... |
| 46 | + |
| 47 | +## Constraints |
| 48 | + |
| 49 | +*What prior decisions and existing conditions limit the possible design?* |
| 50 | + |
| 51 | +* A syntactical prefix must not collide with `nmtoken`, to avoid parsing ambiguities with unquoted literals... |
| 52 | + |
| 53 | +## Proposed Design |
| 54 | + |
| 55 | +*Describe the proposed solution. Consider syntax, formatting, errors, registry, tooling, interchange.* |
| 56 | + |
| 57 | +... |
| 58 | + |
| 59 | +## Alternatives Considered |
| 60 | + |
| 61 | +*What other solutions are available?* |
| 62 | +*How do they compare against the requirements?* |
| 63 | +*What other properties they have?* |
| 64 | + |
| 65 | +### Use unnamed placeholders... |
| 66 | + |
| 67 | +For example: `{Hello, {$}!}`... |
| 68 | + |
| 69 | +* **Use more than once?** No. |
| 70 | +* **Use in selectors?** No. |
| 71 | +* **Reorder?** No. |
| 72 | +* **Clear what the variable refers to?** No. |
| 73 | +* **Migration from MF1 possible?** Yes. |
| 74 | + |
| 75 | +### Use indexed placeholders... |
| 76 | + |
| 77 | +For example: `{Hello, {$1}!}`... |
| 78 | + |
| 79 | +* **Use more than once?** Yes. |
| 80 | +* **Use in selectors?** Yes. |
| 81 | +* **Reorder?** Yes. |
| 82 | +* **Clear what the variable refers to?** No. |
| 83 | +* **Migration from MF1 possible?** Yes. |
0 commit comments