Difference between revisions of "Template:Currency/old/doc"

From blackwiki
Jump to navigation Jump to search
imported>SimonTrew
(→‎Examples: doesn't work for those units now)
imported>GreenC
(Please restore when ready - otherwise could cause confusion)
Line 28: Line 28:
 
*<nowiki>{{Currency|1000|United States}}</nowiki> gives: {{Template:Currency|1000|United States}}
 
*<nowiki>{{Currency|1000|United States}}</nowiki> gives: {{Template:Currency|1000|United States}}
 
*<nowiki>{{Currency|1000|JPY}}</nowiki> gives: {{Template:Currency|1000|JPY}}
 
*<nowiki>{{Currency|1000|JPY}}</nowiki> gives: {{Template:Currency|1000|JPY}}
 
To conform with [[WP:CURRENCY]], some currencies are written with the unit after the amount in English texts; some require a space and some don't. However, this template does not currently work for those currency units:
 
*{{tlc|Currency|1234.56|HUF}} gives: {{Currency|1234.56|HUF}}
 
*{{tlc|Currency|1234.56|BTC}} gives: {{Currency|1234.56|BTC}}
 
  
 
Parameter names can also be used, if preferred:
 
Parameter names can also be used, if preferred:
Line 48: Line 44:
 
* {{tl|Currency/Type}} is the Type sub-template.
 
* {{tl|Currency/Type}} is the Type sub-template.
 
* {{tl|Currency/LongType}} is the LongType sub-template.
 
* {{tl|Currency/LongType}} is the LongType sub-template.
* {{tl|Currency/Format}} splices an amount and a currency symbol in the order suited for that symbol.
 
* {{tl|Currency/Position}} returns a code indicating the desired position of a currency symbol relative to the amount.
 
* {{tl|Currency/Page}} returns a pair of (page, display) for a link to a page and how it should be piped for display.
 
** {{tl|Currency/Link}} constructs a pipe from it.
 
 
* [[Wikipedia:Manual of Style (dates and numbers)#Currencies]] for important usage pattern instructions.
 
* [[Wikipedia:Manual of Style (dates and numbers)#Currencies]] for important usage pattern instructions.
 
* {{tl|Format price}}, a template that handles rounding and "big number" formatting
 
* {{tl|Format price}}, a template that handles rounding and "big number" formatting

Revision as of 16:37, 2 December 2015

Formats a currency value with a link to the page about the currency and the appropriate symbol. The default is to show US$ value.

Usage

  • {{Currency|1000}} gives: US$1,000
Parameters
Name Meaning
amount, Amount,
or the first unnamed parameter
The value to format as a currency number.
The value may contain one decimal separator, which must be a period (example:12345.6).
The value should not contain group separators (commas or spaces).
type, Type,
or the second unnamed parameter
The type of currency to format the value as.
Most currencies are available through the use of the appropriate ISO 4217 currency code. Some of the more popular currencies are also available by using the full name or popular abbreviations.
The default value is to format the value as the United States dollar (US$).
Type values are case insensitive (example: "JPY" and "jpy" give the same result).
first if this parameter is present, with any value given, then the template will return a <value> <currency name> pair instead of the normal <linked symbol><value> pair.
This is provided to comply with the Manual of Style — Dates and Numbers — Currencies, which states "Link the first occurrence of lesser-known currencies (Mongolian tögrögs)".

Examples

Currencies other than the United States dollar can be found by using the appropriate ISO 4217 currency code

Some 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|1000|JPY}} gives: ¥1,000

Parameter names can also be used, if preferred:

  • {{Currency|amount=1000|type=US}} gives: US$1,000
  • {{Currency|1000|type=us}} gives: {{currency}} – invalid amount (help)
  • {{Currency|Amount=1000|euro}} gives: 1,000

The 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|Amount=1000|quid|first=yes}} gives: {{currency}} – invalid code (help)

The Krone currencies (DKK, NOK, SEK) can be represented in two ways:

  • {{Currency|1000|NOK}} gives: kr 1,000 – beware of ambiguity with Danish DKK (kr. 1,000) and Swedish SEK (kr 1,000)
  • {{Currency|1000|NOK2}} gives: NOK 1,000

See also