Decimal and grouping separators swap across regions
Aliases: decimal mark · digit-group separator · decimal separator
What it is
Locale-specific decimal and grouping separators determine which characters mark the fractional boundary and integer grouping. A dot, comma, or space-like character can serve different roles by region, so 1,234 may mean one thousand two hundred thirty-four or one point two three four. An interface should store the number and format it for display; input must be parsed under an explicit locale rather than guessed through global character replacement.
Why it happens
Readers combine symbol position with learned local convention to infer magnitude. A formatter applies a locale's number pattern, numbering system, decimal mark, and grouping mark together; manually replacing a dot with a comma can damage grouping, currency, or non-Latin digits. Parsing is more consequential than display. Under the wrong locale, a parser may treat a comma as an ignorable group mark and turn 1,5 into 15. Parsing must therefore specify a locale and confirm complete input consumption; character equivalence and strictness belong to the input policy.
Where it stops holding
Source code, databases, and APIs may define locale-neutral machine syntax, but a user field should not present that internal protocol as local convention. Scientific data, trading terminals, or multinational teams may also adopt an explicit industry format; the interface must label and parse it consistently. Separator localization does not determine precision, rounding, unit, or currency meaning.
Applying it
- Keep numeric types in the data layer and call a locale-aware formatter for display; never calculate or sort on formatted strings.
- Inspect the actual decimal and group symbols for each target locale and numbering system. If currency uses dedicated
currencyDecimalorcurrencyGroup, leave them to the currency formatter. - Any reverse parse must specify a locale, consume the complete input, and reject unexplained trailing characters; lenient, strict, and confirmation behavior belongs to the numeric-input contract.
- Check magnitude, assistive speech, and copied characters in UI and export samples so visually similar marks cannot conceal a changed value.