Commit 1d17794
committed
Automatically format interpolated numbers, fixes CNVS-34757
On the front-end, automatically localize numbers that are part of a
localized string even if the developer has forgotten to do so
explicitly. We already did this for the %{count} placeholder, now
do it for any interpolated number. Any explicitly localized numbers
will be unaffected.
This makes localizing numbers in handlebars-land a lot easier, e.g.
just do: {{#t}}User count: {{num}}{{/t}}
Test plan:
* Confirm localization works as per usual
* Confirm this new behavior works in places where we don't explicitly
localize the number, e.g. set a group's max membership to 1000, and
confirm this string has "1,000" in the UI:
"%{member_count} members out of maximum of %{max_membership}"
Change-Id: I388407fbccb04a26e7da7e3ec82b68ce9f5985f9
Reviewed-on: https://gerrit.instructure.com/101076
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Tested-by: Jenkins
QA-Review: Cemal Aktas <caktas@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>1 parent 9fad40e commit 1d17794
2 files changed
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
10 | 32 | | |
11 | 33 | | |
12 | 34 | | |
| |||
211 | 233 | | |
212 | 234 | | |
213 | 235 | | |
| 236 | + | |
214 | 237 | | |
215 | 238 | | |
216 | 239 | | |
| |||
229 | 252 | | |
230 | 253 | | |
231 | 254 | | |
232 | | - | |
233 | | - | |
| 255 | + | |
| 256 | + | |
234 | 257 | | |
235 | 258 | | |
236 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
80 | 92 | | |
81 | 93 | | |
82 | 94 | | |
| |||
0 commit comments