Skip to content

An article about number, currency, and unit formatting #410

Open
@xfq

Description

@xfq

Can we write an article about currency? It's useful for both spec developers and content authors.

Here are some concepts we can mention:

Decimal separator

Some regions use a period (.) as a separator to separate the integer part from the fractional part. Some regions use a comma (,). Some regioins use the currency symbol (such as the Cape Verdean escudo).

Currencies can have two decimals (like GBP), three decimals (like BHD), or no decimals (like VND).

Digit grouping

Some regions use a comma to separate thousands. Some regions use a period for this purpose.

Some regions use 2-digit grouping or 4-digit grouping.

Negative currency

The negative sign can be used:

  • before both the currency symbol and number
  • before the number but after the currency symbol
  • after the number

Alternatively, the number can be displayed with parentheses around it or even in a colour such as red.

Numbering system

Numbers can be European numerals or locale-specific (such as Chinese/Japanese or Devanagari).

Currency symbol

It can be a pre-defined symbol such as the European Euro '€' or a combination of letters like the use of 'CNY' for Renminbi yuan.

It can be placed before or after the digits.

The same currency symbol may represent multiple currencies.

API

When designing a currency formatting API, it should:

  • let the content author choose whether to show the digit grouping (like the thousands separator)
  • let the content author round the number, and choose among ceil, floor, and round
  • support symbols like K, M, B, T
  • enable content authors to customize their own currency formats such as $123.4万

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions