Page semi-protected

Template:Formatnum

From Wikidata
Jump to navigation Jump to search
Documentation icon Template documentation[view · edit · history · purge ]

This template formats a number in the local format (local numerals, local thousands separator, decimal separator and the pattern of separators [some languages for example have a ten-thousands separator]) of the user's preferred language.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
number1 number

Number that will be formatted. It must be unformatted.

Example
1234
Linerequired
language2 lang

Language code, only to be given if the language shall be fixed; by default the user interface language.

Default
{{int:lang}}
Example
fr
Lineoptional
no separatorssep

Any non-empty value will remove thousands seperators.

Lineoptional
precisionprec

The number of decimal digits to show. If given as a positive number, exactly that many decimal digits will be shown, and the number will be truncated (not rounded!) or zero-padded if needed. If not given or it's nonpositive, all decimal digits will be shown, except for trailing zeros.

Default
0
Numberoptional

Examples

  • {{Formatnum|1234}} --> 1,234