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

From blackwiki
Jump to navigation Jump to search
imported>Ohms law
(Created documentation subpage)
 
imported>SimonTrew
(Add examples HUF, MYR, CNY)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
This is the type sub-template to [[User:Ohms law/Currency]]. The LongType sub-template converts the values it is given to the appropriate currency plus the linked currency name (for example: <nowiki>[[United States Dollar]]s</nowiki>).
+
This is the type sub-template to [[Template:Currency]]. The LongType sub-template converts the values it is given to the appropriate currency plus the linked currency name (for example: <nowiki>[[United States dollar]]s</nowiki>).
  
 
=== Usage ===
 
=== Usage ===
 
<span style="font-weight:bold; background-color:Seashell">Note: <span style="color:orange;">This template should generally not be used alone.</span></span>
 
<span style="font-weight:bold; background-color:Seashell">Note: <span style="color:orange;">This template should generally not be used alone.</span></span>
  
This template uses two unnamed parameters, the second of which is matched against a switch\case structure to find the linked currency name to output. Note that any value given to it is converted to upper case before processing for matches, so this template does not distinguish between "United States" and "UNITED STATES", for example. The first parameter should be the amount of the currency.
+
This template uses two unnamed parameters, the second of which is matched against a table to find the linked currency name to output. Note that any value given to it is converted to upper case before processing for matches, so this template does not distinguish between "United States" and "UNITED STATES", for example. The first parameter should be the amount of the currency. If the currency parameter is empty, US dollars are assumed; if it matches no entry, [[undefined behavior|behavior is undefined]].
  
 +
=== Examples ===
 +
{| class="wikitable"
 +
! scope="col" | Parameter !! scope="col" | Result
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|GBP}} || {{Currency/LongType|1234.56|GBP}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|EUR}} || {{Currency/LongType|1234.56|EUR}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|USD}} || {{Currency/LongType|1234.56|USD}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|GRD}} || {{Currency/LongType|1234.56|GRD}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|SEK}} || {{Currency/LongType|1234.56|SEK}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|HUF}} || {{Currency/LongType|1234.56|HUF}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|MYR}} || {{Currency/LongType|1234.56|MYR}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|CNY}} || {{Currency/LongType|1234.56|CNY}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|unknown}} || {{Currency/LongType|1234.56|unknown}}
 +
|-
 +
| {{tlc|Currency/LongType|1234.56|}} || {{Currency/LongType|1234.56|}}
 +
|}
 
=== See also ===
 
=== See also ===
* [[User:Ohms law/Currency]]
+
* [[Template:Currency]]
  
 
<includeonly>
 
<includeonly>

Latest revision as of 16:11, 30 November 2015

This is the type sub-template to Template:Currency. The LongType sub-template converts the values it is given to the appropriate currency plus the linked currency name (for example: [[United States dollar]]s).

Usage

Note: This template should generally not be used alone.

This template uses two unnamed parameters, the second of which is matched against a table to find the linked currency name to output. Note that any value given to it is converted to upper case before processing for matches, so this template does not distinguish between "United States" and "UNITED STATES", for example. The first parameter should be the amount of the currency. If the currency parameter is empty, US dollars are assumed; if it matches no entry, behavior is undefined.

Examples

Parameter Result
{{Currency/LongType|1234.56|GBP}} 1,234.56 pounds sterling
{{Currency/LongType|1234.56|EUR}} 1,234.56 Euros
{{Currency/LongType|1234.56|USD}} 1,234.56 United States dollars
{{Currency/LongType|1234.56|GRD}} 1,234.56 Greek drachmae
{{Currency/LongType|1234.56|SEK}} 1,234.56 Swedish kronor
{{Currency/LongType|1234.56|HUF}} 1,234.56 Hungarian forints
{{Currency/LongType|1234.56|MYR}} 1,234.56 Malaysian ringgit
{{Currency/LongType|1234.56|CNY}} 1,234.56 Renminbi
{{Currency/LongType|1234.56|unknown}} 1,234.56 United States dollars
{{Currency/LongType|1234.56|}} 1,234.56 United States dollars

See also