模板:US$/sandbox
| File:Sandbox.svg | 这是Template:US$(差异)的沙盒。 参见本模板的测试样例。 |
概要[编辑]
This is a multifunction template. At its simplest, it adds the currency mark "US$", as recommended by MOS:CURRENCY for many situations. The template can also link to the United States dollar article and can even calculate inflation. See warnings below.
参数及使用方法[编辑]
{{US$|數目}}
范例:
{{US$}}→ 美元{{US$|1234.56}}→ 1,234.56美元{{US$|1.23千萬}}→ 1.23千万美元
连结[编辑]
The parameter |link=yes may be used to link US$ to the article United States dollar. This is turned off by default, but may be appropriate for the first occurrence of the term in an article.
范例:
{{US$|123.45}}→ 123.45美元{{US$|123.45|link=yes}}→ 123.45美元
计算通胀[编辑]
| File:Ambox important.svg | This template is only capable of inflating Consumer Price Index values: staples, workers' rent, small service bills (doctor's costs, train tickets). This template is incapable of inflating capital expenses, government expenses, or the personal wealth and expenditure of the rich. Incorrect use of this template would constitute original research. If you yourself do not have economic training, then please consult someone who does before using this template. | File:Emblem-money.svg |
| File:Ambox important.svg | Do not assume that using this template will mean that a calculated value is "current", "as of 2026", "as of 2025" or even necessarily "recent". Do not use {{CURRENTYEAR}} to refer to calculated value, instead {{Inflation/year|US}} may be used. See also MOS:REALTIME. | File:Current event warning.svg |
The template supports inflation calculation, by way of {{Inflation}}. If the second parameter is used, to specify a year, and this year is within a certain range of available inflation data (specifically, if 1800 ≤ year < 2025), the equivalent value represented in 2025 dollars will be calculated in parentheses. However, this function should only be used in appropriate situations.
- Examples
{{US$|100|1799}}→ 100美元{{US$|100|1800}}→ 100美元(相等于2025年的1,897美元){{US$|100|1966}}→ 100美元(相等于2025年的992.31美元){{US$|100|1966|link=yes}}→ 100美元(相等于2025年的992.31美元){{US$|100|2024}}→ 100美元(相等于2025年的102.63美元){{US$|100|2025}}→ 100美元{{US$|100|2026}}→ 100美元{{US$|100|2027}}→ 100美元
Additional parameter |about=yes will cause the template to calculate to the nearest dollar (instead of the nearest cent), and prefix the calculated value with "about". The rounding can be fine-tuned further by using |round=integer. These parameters may be combined.
- Examples
{{US$|10|1935}}→ 10美元(相等于2025年的234.83美元){{US$|10|1935|round=0}}→ 10美元(相等于2025年的235美元){{US$|10|1935|about=yes}}→ 10美元(相等于2025年的约235美元){{US$|1000|1935|round=2}}→ 1,000美元(相等于2025年的23,483.01美元){{US$|1000|1935|round=-2}}→ 1,000美元(相等于2025年的23,500美元){{US$|1000|1935|round=-2|about=yes}}→ 1,000美元(相等于2025年的约23,500美元)
- Caution
The inflation-calculation code causes this template to approach the 40-deep expansion depth limit in the software that makes Wikipedia work. Pages that exceed this limit are placed in Category:Pages where expansion depth is exceeded. Using |about=yes can reduce the impact somewhat. If you call this template from within another template and use the inflation feature, consider adding a caution similar to this one to that template's documention page.
重定向[编辑]
模板编辑说明[编辑]
<templatedata> { "params": { "1": { "label": "数目", "description": "美元数目", "type": "number", "required": true }, "2": { "label": "年份", "description": "Specify a year and, if this year is between 1800 and the current year minus 1, the inflation-adjusted value will be calculated in parentheses", "type": "number", "suggested": true, "aliases": [ "year" ] }, "link": { "label": "加入连结?", "description": "Link US$ to article", "example": "yes", "type": "boolean", "suggested": true }, "about": { "label": "About?", "description": "If yes, calculate to the nearest dollar (instead of the nearest cent) and prefix the calculated value with \"about\"", "example": "yes", "type": "boolean" }, "round": { "label": "Decimal points", "description": "Integer, where round to number of decimal points specified, use negative (for example, -2) for significant figures", "example": "2", "type": "number", "suggested": true } }, "description": "This is a multifunction template. At its simplest, it adds the currency mark \"US$\", as recommended by MOS:CURRENCY for many situations. The template can also link to the United States dollar article and can even calculate inflation.", "format": "inline" } </templatedata>