This is the template sandbox page for Template:Currency (diff). See also the companion subpage for test cases. |
This template is used on approximately 4,300 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
Preview message: Transclusion count updated automatically (see documentation). |
This template uses Lua: |
Related pages |
---|
Formats a currency value with the appropriate symbol which is linked to the article about the currency. If no currency is specified, the template will show the amount in United States dollars.
Using unnamed parameters:
{{currency|value|code|first=|linked=|fmt=|passthrough=}}
Using named parameters:
{{currency|amount=value|code=code|first=|linked=|passthrough=}}
where:
|first=
when set to any value produces a long-form currency name|linked=
when set to no
disables wikilinks on the rendered currency symbol or long-form currency name|fmt=
specifies how value digit-groups are separated:
commas
(default) separates value digit-groups with commas; this is the default, same as when |fmt=
is empty or omittedgaps
separates value digit-groups with narrow gaps.none
renders value without digit grouping.|passthrough=
specifies whether or not the template should attempt to parse the number according to |fmt=
or just put whatever string is provided in |amount=
directly after the currency sign. Should have value of either |passthrough=yes
or |passthrough=no
When using parameter names, |amount=
and |code=
are preferred. The template will also accept |Amount=
and |type=
and |Type=
though.
Note: Using both named and unnamed parameters may produce unexpected results. In this example, the template expects the first unnamed parameter to be a value number:
These non-standard codes are aliases of standard ISO 4217 codes.
These codes either do not have a matching ISO 4217 currency code or are alternate versions of existing ISO 4217 codes or support unique aspects of a currency.
Currencies other than the United States dollar can be rendered by using the appropriate ISO 4217 currency code
{{Currency|1000|BMD}}
gives: BD$1,000 for the Bermudian dollar{{Currency|1000|BDT}}
gives: ৳1,000 for the Bangladeshi taka{{Currency|1000|AMD}}
gives: ֏ 1,000 for the Armenian dramSome of the more well known currencies also provide the ability to use common abbreviations or full names.
{{Currency|1000|US}}
gives: US$1,000{{Currency|1000|United States}}
gives: US$1,000{{Currency|1,000|JPY}}
gives: ¥1,000Parameter names can also be used, if preferred:
Negative amount:
{{Currency|amount=-1000|code=US}}
gives: US$−1,000Text quantifiers:
{{Currency|1000 million|code=euro}}
gives: €1,000,000,000{{Currency|1000M|code=euro}}
gives: €1,000,000,000The first use of a currency should show the value and the full name of the currency, so if the "first" parameter is defined then that is what will be given.
{{Currency|1000|cve|first=yes}}
gives: 1,000 Cape Verde escudos{{Currency|1000|cve}}
gives: 1.000$00Because the symbol for the currencies DKK, NOK, and SEK may be ambiguous, these may be represented in two ways:
Similarly, some currencies use different symbols for single and plural amounts:
Digit grouping:
|fmt=commas
{{Currency|1000 million|code=euro|fmt=commas}}
gives: €1,000,000,000|fmt=gaps
{{Currency|1000 million|code=euro|fmt=gaps}}
gives: €1000000000|fmt=none
{{Currency|1000 million|code=euro|fmt=none}}
gives: €1000000000Passthrough:
|passthrough=yes
|passthrough=no
|fmt=
instead. |passthrough=
should only be used in ways compatible with MOS:CURRENCY.{{currency}}
can produce several error message. These are:
|code=
cannot be found in the template's list of codes. Make sure that the assigned code is a correct ISO 4217 currency code or one of the supported non-standard codes listed above.|amount=
contains one or more characters that is not a minus sign, a digit, comma, or decimal point, or has some text that is not one of the permitted quantifiers. Make sure that comma separators group three digits and that the number has only one decimal point. Make sure that the amount and code parameters are either both named (|amount=
and |code=
) or both unnamed.TemplateData for Currency
Use this template to provide a linked currency symbol and the amount of cash.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Amount | 1 amount Amount | The value in the given currency | Line | required |
Currency | 2 code type Type | The currency represented. Should be a valid ISO 4217 code or one of the special codes listed on the template’s page
| Line | suggested |
Long form | first | When set to any value, produces a long-form currency name. This should be used for the first mention of a currency within the article | Line | optional |
Link currency | linked | Whether to link to the article on that currency. “no” suppresses the link, any other value displays it
| Line | optional |
Format | fmt | Specifies how value digit-groups are separated: commas, gaps or none
| Line | optional |
Passthrough | passthrough | If "yes", put the string in Amount directly after its symbol without turning it into a number.
| Line | optional |
{{Infobox currency}}