These locales and its names are based on this International Language Environments Guide
This is the Locale type and constructor.
The base locale uses unicode minus (U+2212) instead of a hyphen/dash
for visual consistency.
Note that String.toFloat does not understand unicode minus (U+2212), thus
it will return Nothing for negative number strings formatted using base
locale.
If you need a result compatible with String.toFloat, consider
creating your own locale with hypen as the negativePrefix or use a custom
string to float function that handles U+2212 if need be.
Reads a JavaScript's Number.toLocaleString() return value to create the
Locale according to the user's local settings. This is useful when combined
with Elm's Flags, e.g.:
Elm.Main.init\({
flags: {
numberFormat: (Math.PI * -1000).toLocaleString()
}
}\)Then we use fromString to read this value from the flag (although it does
not cover the case with zero decimal places). If it fails to parse the string
to a Locale, it will return the base locale.
fromString "-3,141.593"
--> { base
--> | decimals = Exact 3
--> , thousandSeparator = ","
--> , decimalSeparator = "."
--> , negativePrefix = "-"
--> }Locale used in France, Canada, Finland and Sweden. It has 3 decimals
digits, uses a thin space (U+202F) as thousand separator and a , as decimal
separator. It uses a minus sign (not a hyphen) as a prefix for negative
numbers, but no suffix or prefix for positive numbers.
Locale used in Spain, Italy and Norway. It has 3 decimals digits, uses a
. as thousand separator and a , as decimal separator. It uses a minus sign
(not a hyphen) as a prefix for negative numbers, but no suffix or prefix for
positive numbers.
Locale used in the United States, Great Britain and Thailand. It has 2
decimals digits, uses a , as thousand separator and a . as decimal
separator. It uses a minus sign (not a hyphen) as a prefix for negative
numbers, no suffix or prefix for positive numbers.
The
Decimalstype contains different strategies for handling the number of decimals when formatting the number:MinIntshows at least a certain amount of decimal digits, adding trailing zeros if needed.MaxIntshows up to a certain amount of decimal digits, discarding trailing zeros if needed.ExactIntshows an exact number of decimal digits, adding trailing zeros if needed.