Locale-aware formatting presets #44
Labels
No labels
kind
bug
kind
enhancement
kind
refactor
workflow
needs-info
workflow
needs-triage
workflow
ready-for-agent
workflow
ready-for-human
workflow
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rosa/lucre#44
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Formatrequires the caller to specify separators, symbol position, and negative style by hand. Formatting1234.56EUR for a German reader (1.234,56 €) versus a US reader (€1,234.56) means knowing each locale's conventions. CLDR already encodes them.Proposal
Locale presets layered on the existing
Formatstruct:Format::for_locale(locale)that fills in separators, symbol position, and spacing from CLDR data. Callers can still override fields afterward.($1,234.56).$1.2K,$3.4M, for dashboards and charts.Open questions
icu(heavy), generate a table at build time from CLDR JSON (like the ISO table), or hand-curate the top N locales. Data size versus coverage is the main trade-off.Formator as a separate formatter, since it discards precision.