Problem/Motivation
In the "Manage display" tab on a node you can set a format for field of type "Number (decimal). When you choose "Default" there are some settings for thousand marker and decimal marker, but these are not language specific. I would like them to be translatable or at least have an option like "Default for display language" and have them set automatically according to the locale of each language.
In some countries, 1,000 means one (1), whereas in other countries, the comma is used as a thousand separator, so it means one thousand (1000).
We can translate Label, Prefix, and Suffix for a field, but wouldn't it be great to also be able to set the Thousand marker and Decimal marker by language?
Steps to reproduce
Proposed resolution
-
Localization on Regional settings page
Add Localization options for each installed language on the Regional settings page (/admin/config/regional/settings), inside the Locale fieldset. The user can set custom separators for each installed language (da, en, fr, etc.).

Detaching language from localization givers more flexibility to the site owner. He may want to use a different set of number separators than what we would expect for his region.
Consider adding those settings to the user profile page as well, so a user is able to override the global localization settings.
-
Using Localization for each installed language in field displays
Add a new option under the "Thousand marker" and "Decimal marker" settings from the "Manage display" page (
/admin/structure/types/manage/article/display).It could be an option the user can select, where either a global character is used, or a language specific. The current select options could be updated to this:
Thousand marker
- - None -
- Decimal point
- Comma
- Space
- Thin space
- Default for display language
<<< Add this option
Decimal marker
- Decimal point
- Comma
- Default for display language
<<< Add this option
Remaining tasks
For the number formats https://www.drupal.org/project/advanced_number_format might be a good starting point if we want to start in contrib, and eventually get it into Drupal core.
Comments
Comment #9
avpadernoComment #10
avpadernoComment #16
ressaThis is a great idea. I created a duplicate issue the other day, which I will close. (#3525024: Allow translating Thousand marker and Decimal marker under Display)
Comment #17
ressaComment #18
ressaComment #19
ressaComment #20
ressaUpdating Issue Summary based on great discussion in #1345758: META: Provide locale (regional) formats framework for automated translation of non textual data .
Comment #21
anybodyFor the number formats https://www.drupal.org/project/advanced_number_format might be a good starting point if we want to start in contrib.
Comment #22
ressaThanks for the suggestion @anybody! I have added it in the Issue Summary to highlight your great initiative.
Though that also seems to include number manipulation (such as rounding), which could add complexity, whereas the scope here is purely presentation, and visualizing numbers by defining Thousand and Decimal separators ... But if the added features are not blockers, it's no problem. Also, I do see the benefit of thinking more holistically about it, though that may also cause an issue to balloon, and get bikeshedded. It's a balance :)
Comment #23
xmacinfoYes, indeed, we only need to touch presentation.
In the database (or result of calculation, eg. sales tax) me may have a value of “1.131416”. When presenting that value, the display would be transformed to:
Decimals and thousands separators:
Typical English localization:
1.131,416
Typical French localization:
1,131 416
Typical English localization:
10 123.13
Typical French localization:
10 123,13
Currency sign formatter:
Typical English localization:
$10 123.13
Typical French localization:
10 123,13 $
etc.
For measurements units, the database must also store the default measurement unit, most probably loaded from a config. So, if the config for the site is set to imperial units, we can still use a single value in the database and load the unit config at display time.
Example of a Canadian number with a measurement unit coming from default:
Typical Canadian English localization:
1.5L
Typical French localization:
1,5 L
Not sure if core should offers tool to convert unit of measures or use a vendor.
But the UI, if enabled, should let users convert unit of measures easily.