Repository navigation
Commit db42e68
committed
Account for missing ordinal categories in from_format candidates
Locales like Italian map only some plural categories (custom.ordinal
has just 'other' -> '°'), so numbers in unmapped categories (8, 11, 80
use 'many') are formatted as plain digits by Locale.ordinalize().
from_format previously only accepted plain digits when the locale had
no ordinal map at all, so parsing its own output raised ValueError.
Always append a plain-digit fallback candidate alongside the suffixed
forms so every ordinal token (Do, Mo, Qo, DDDo) accepts what format()
emits.
Add the Italian 'many' case from the review as a regression test.
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>1 parent 18012f1 commit db42e68
2 files changed
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | 58 | | |
61 | | - | |
| 59 | + | |
62 | 60 | | |
63 | 61 | | |
64 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
244 | 259 | | |
245 | 260 | | |
246 | 261 | | |
| |||
0 commit comments