cuducos/elm-format-number/8.0.0

NOTE: the latest version is 9.0.1

FormatNumber.Locales

These locales and its names are based on this International Language Environments Guide

= Min Int
| Max Int
| Exact Int

The Decimals type contains different strategies for handling the number of decimals when formatting the number:

  • Min Int shows at least a certain amount of decimal digits, adding trailing zeros if needed.
  • Max Int shows up to a certain amount of decimal digits, discarding trailing zeros if needed.
  • Exact Int shows an exact number of decimal digits, adding trailing zeros if needed.
type alias Locale =
{ decimals : Decimals
, thousandSeparator : String
, decimalSeparator : String
, negativePrefix : String
, negativeSuffix : String
, positivePrefix : String
, positiveSuffix : String
, zeroPrefix : String
, zeroSuffix : String
}

This is the Locale type and constructor.

base : Locale

The base locale matches Elm's native String.fromFloat using unicode minus (U+2212) instead of an hyphen/dash.

Pre-defined locales

frenchLocale : Locale

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.

spanishLocale : Locale

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.

usLocale : Locale

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.