Internationally friendly decimal quantities

I was recently in a discussion about decimal / comma ambiguity (it came about as a result of a vendor product not working for me due to regional settings, but that's neither here nor there), but we can to an interesting conclusion: how does one specify what decimal / separators / units to use when entering things into an online form, as an example?

I'm specifically thinking of a situation where the form expects you to enter a decimal quantity, say for a "dimensions" or "length" in the case that something you are ordering supports it.

The image below shows four versions, the top of which is pretty standard, then the 3 others being different modifications to accommodate internationalization.

In the case of each, I would expect the application (in this case) to offer the user a selection between "Metric" and "Imperial" measurements, which it could then do some back-end math to convert to a unified unit (probably convert imperial to cm, with up to 3 decimals for precision, but we'll ignore storage for the moment).

The third version seems best to me: it allows the user to be precise with their measurements, and eliminates decimal / unit ambiguity. The user doesn't need to convert their measurements between units, as the application knows the unit they expected with the measurement.

Metric is on the left, Imperial on the right. In all cases we want 1 and 1/4 of the base unit, 1m 25cm for Metric, or 1ft 3in for Imperial.

While there's ambiguity on a global level, for the vast majority of locales (if not all of them), there's always one standard you can go with. You can show and allow decimal points vs. commas based on the locale of the interface.

TL;DR: Figure out what units and format your users expect for your given situation, and design around that. Everything below is my opinion and experience with unit entry.

Although version three is a good choice from an expected-input standpoint, I'm afraid it could be confusing to the user, as typically dimensions are input as a single unit. For example, which do you find easier to process?

`2m 25cm x 3m 4cm`

or

`2.25m x 3.04m`

Also, a multi-unit form opens the possibility for odd entries such as this:

`2m 200cm`

or

`1.4ft 4in`

Keeping the units consistent makes it easier to input for the user, and to develop on the front-end. You may want to parse it later out into different formats (as it looks like you have). For example, often times floor plans are displayed in separate units (e.g. 1' 9").

As for the comma, that's easy: just implement the input form to handle both periods and commas. In Regex, that's a simple group check: `[.,]`

Here are two examples used in software today. Note the single unit, and both period and comma support (depending on region):

Photoshop

Office

• This works as long as you also account for a thousands separator. This may mean doing some logic to interpret the data, or disallowing thousands separators completely. You should be able to interpret 1.024,751 and 1,024.751 and 1024.751 and 1024,751 as the same number.
– Dwev
Commented Jan 20, 2018 at 6:54