template:to USD round/doc#Syntax

{{documentation subpage}}

{{tsh|USDr|To USD r|ToUSDr}}

This template converts a value given in the national currency of a given country to a round US dollar figure. The intended use is for large round figures, when you don't want {{euro|3.2 million}} turning into {{US$|{{To USD|3200000|FRA}}}}, you just want a round figure like {{US$|{{To USD round|3200000|FRA}}}}. It tries to mimic the same number of significant figures as are present in the original amount. The template uses values published by the IMF.{{cite web|url=http://data.worldbank.org/indicator/PA.NUS.FCRF|title=Official exchange rate (LCU per US$, period average)|accessdate = 14 April 2013}}

= Usage =

{{To USD round|AMOUNT|COUNTRY|YEAR|sf=SIGFIG}}

= Parameters =

There are three unnamed parameters, and one named parameter:

  • {{para|1}} is the amount in local currency to be converted to US dollars. Required.
  • {{para|2}} is the name or 3-letter ISO code of the country whose currency is being converted. Required.
  • {{para|3}} is the year to use for the US dollar exchange rate against the currency of the other country. Possible values: see {{slink||Data subtemplates}} below. Optional; default = {{pval|2019}}.
  • {{para|sf}} is number of significant figures. The converted value is displayed to that precision. Optional; the default is the number of significant figures in the amount given in param 1.

=Examples=

  • {{To USD round|5200|Mexico}} displays {{To USD round|5200|Mexico}}. That is, 5200 Mexican pesos would exchange to roughly {{To USD round|5200|MEX}} US dollars (to two significant digits) at the 2019 exchange rate.
  • {{tlg|To USD round|5200|MEX|code=1|_show_result=1}}
  • {{tlg|To USD round|1250|FRA|code=1|_show_result=1}}
  • {{tlg|To USD round|5200|MEX|sf=3|code=1|_show_result=1}}
  • {{Formatnum:{{To USD round|185000|RUS}}}} ⟶ {{Formatnum:{{To USD round|1850000|RUS}}}}.
  • {{To USD round|5200|MEX|year=1998}} displays {{To USD round|5200|MEX|year=1998}} since data for 1998 has not been defined. It will add the page to :Category:Pages using an undefined year in {{ARTICLEPAGENAME}}
  • {{To USD round|5200|MEX|year=2009}} displays {{To USD round|5200|MEX|year=2009}} since data for 2009 has not been entered for Mexico. It will add the page to :Category:Pages using an undefined country code in {{ARTICLEPAGENAME}}

----

  • {{tlg|To USD round|586000|BRA|year{{=}}2011|code=1|_show_result=1}}
  • {{tlg|To USD round|586000|BRA|year{{=}}2019|code=1|_show_result=1}}
  • {{tlg|To USD round|586000|BRA|year{{=}}|code=1|_show_result=1}}
  • {{tlg|To USD round|586000|BRA|code=1|_show_result=1}}
  • {{tlg|To USD round|620000000|BRA|year{{=}}2015|code=1|_show_result=1}}
  • {{tlg|To USD round|620000000|BRA|year{{=}}2015|sf{{=}}4|code=1|_show_result=1}}
  • {{tlg|To USD round|640|MEX|sf{{=}}5|code=1|_show_result=1}} # Some combos make no sense; USD doesn't have tenths of a cent.

=See also=

=Data subtemplates=

{{excerpt|Template:To USD/doc|Data subtemplates|hat=no}}

=References=

{{reflist}}

{{Sandbox other||

{{DEFAULTSORT:{{BASEPAGENAME}}}}

Category:Currency conversion templates

}}

TemplateData

{{TemplateDataHeader}}

{

"params": {

"1": {

"label": "amount",

"description": "value in foreign currency to convert to USD",

"example": "175000",

"type": "number",

"required": true

},

"2": {

"aliases": [

"country"

],

"label": "country code",

"description": "ISO 3166-1 alpha-3 country code",

"example": "MEX",

"type": "line",

"required": true

},

"year": {

"description": "Year to convert currency. Values: 1960–2022.",

"example": "2002",

"type": "number",

"default": "2019",

"required": false

},

"sf": {

"label": "significant figures",

"description": "If numeric, rounds to that many significant figures. If omitted, rounds to number of significant figures in 'amount'.",

"example": "3",

"type": "number"

}

},

"description": "Template to convert other currencies into United States dollars, by year, based on information from the International Monetary Fund, and with selected number of significant figures"

}