模板:US$/sandbox
這是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美元
計算通脹
Do not assume that using this template will mean that a calculated value is "current", "as of 2024", "as of 2023" or even necessarily "recent". Do not use {{CURRENTYEAR}} to refer to calculated value, instead {{Inflation/year|US}} may be used. See also MOS:REALTIME. |
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
< 2023), the equivalent value represented in 2023 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美元(相等於2023年的1,795美元){{US$|100|1966}}
→ 100美元(相等於2023年的939.08美元){{US$|100|1966|link=yes}}
→ 100美元(相等於2023年的939.08美元){{US$|100|2022}}
→ 100美元(相等於2023年的104.12美元){{US$|100|2023}}
→ 100美元{{US$|100|2024}}
→ 100美元{{US$|100|2025}}
→ 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美元(相等於2023年的222.23美元){{US$|10|1935|round=0}}
→ 10美元(相等於2023年的222美元){{US$|10|1935|about=yes}}
→ 10美元(相等於2023年的約222美元){{US$|1000|1935|round=2}}
→ 1,000美元(相等於2023年的22,223.3美元){{US$|1000|1935|round=-2}}
→ 1,000美元(相等於2023年的22,200美元){{US$|1000|1935|round=-2|about=yes}}
→ 1,000美元(相等於2023年的約22,200美元)
- 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.
重定向
模板編輯說明
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.
參數 | 描述 | 類型 | 狀態 | |
---|---|---|---|---|
數目 | 1 | 美元數目 | 數值 | 必填 |
年份 | 2 year | 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 | 數值 | 建議 |
加入連結? | link | Link US$ to article
| 布林值 | 建議 |
About? | about | If yes, calculate to the nearest dollar (instead of the nearest cent) and prefix the calculated value with "about"
| 布林值 | 非必填 |
Decimal points | round | Integer, where round to number of decimal points specified, use negative (for example, -2) for significant figures
| 數值 | 建議 |