模板有三个必填参数,包括country_codevaluestart_year。通胀率资料可在模板的子页面找到及编辑,如美国通胀率资料存在Template:Inflation/US/dataset,每年有新的资料,所有引用此模板的页面便会自动更新。

另外,编者可使用end_year参数,指定某年之间的通胀率。

用法

编辑
{{Inflation|國家代碼|value|start_year}}
{{Inflation|國家代碼|value|start_year|end_year}}
{{Inflation|國家代碼|value|start_year|r=decimals|fmt=c}}
{{Inflation|國家代碼|value|start_year|r=decimals|fmt=eq}}
{{Inflation|國家代碼|value|start_year|r=decimals|fmt=eq|cursign=X}}

此模板支援以下的货币:

國家代碼 国家 最早支援年份start_year 最晚支援年份end_year
AU 澳洲[1] 1901 2018
AU-road 澳洲[...?][2] 1998 2018
CA 加拿大[3] 1688 2020
DE 德国[4] 1882 2021
JP 日本[5] 1946 2019
UK 英国[6] 1209 2021
US 美国[7] 1800 2023
US-GDP 美国平均物价指数[8] 1790 2020
  • end_year:如有输入,数值必须比start_year大,比现时年份小。没有输入则预设为今年。
  • r=digit:设定四舍五入至某个数值,预设为0。

例子:


  • Green tickY {{Inflation|DE|1000000|2000}} = 661641
  • Green tickY {{Inflation|US|1000000|2001|2001}} = 相当于2001年的$1,000,000
  • Green tickY {{Inflation|US|1000000|1990|2005|r=2}} = 1494905.76
  • Green tickY {{Inflation|UK|1000000|1323|1978|r=-3}} = 114610000
  • Green tickY {{Inflation|JP|100|2000}}102
  • Green tickY {{Inflation|DE|100|2000}}66
  • Green tickY {{Inflation|US|595|1982}}1879
  • Green tickY {{Inflation|US|595|1982|fmt=eq}}相当于2023年的$1,879
  • Green tickY {{Inflation|US|800|1942|fmt=eq|r=-3}}相当于2023年的$15,000
  • Green tickY {{Inflation|US|100|2010|2012|fmt=eq|r=2}}相当于2012年的$105.28
  • Green tickY US$595({{Inflation|US|595|1982|fmt=eq}}US$595(相当于2023年的$1,879)
  • Green tickY US$595({{Inflation|US|595|1982|fmt=eq|cursign=[[美元|US$]]}}US$595(相当于2023年的US$1,879)
  • Green tickY $2,100萬(相当于{{Inflation/year|US}}的${{Inflation|US|2100|2005|r=0}}萬)$2,100万(相当于2023年的$3276万)
  • Green tickY {{Inflation|UK|1|1209|fmt=eq|cursign=£}}相当于2021年的£1,499
  • Green tickY {{Inflation|AU|100|2024|fmt=eq}}相当于2024年的$100
  • Green tickY {{Inflation/year|US}}年的${{Inflation|US|100|2024}}2023年的$100
  • Green tickY {{Inflation|UK|100|1982|fmt=eq|orig=yes|cursign=£}}相当于2021年的£375


参数不当会显示NaN

  • Red XN {{Inflation}} = 使用{{Inflation}}时出错: |index= (参数1), |value= (参数2) and |start_year= (参数3) 必须被指定。
  • Red XN {{Inflation|abc}} = 使用{{Inflation}}时出错: |value= (参数2) and |start_year= (参数3) 必须被指定。
  • Red XN {{Inflation|DE|1000000}} = 使用{{Inflation}}时出错: |start_year= (参数3) 必须被指定。
  • Red XN {{Inflation|US|1000000|1200|3000}} = 使用{{Inflation}}时出错: |start_year=1200 (参数3) 低于索引"US"最早可用年(1800)。 and |end_year=3000 (参数4) 大于索引"US"的最新可用年(2023).
  • Red XN {{Inflation|UK|1000000|2005|2004}} = 使用{{Inflation}}时出错: |start_year=2005 (参数3) 大于 |end_year=2004 (参数4).

提示与技巧

编辑
货币转换
编辑

此模板不能转换货币单位,因此,如果想知道1960时的1000德国马克于现在的价值,输入{{Inflation|DE|1000|1960|r=2}}显示的数值仍为德国马克,而非欧元。

所以,如要转换货币单位,需要手动输入数式,下面例子定义€ 1 = DM 1.95583:

  • Green tickY {{#expr:({{Inflation|DE|1000|1960|r=2}} / 1.95583) round 2}}
四舍五入
编辑

|r=参数可以定义要四舍五入的数位,输入|r=2会约至2个小数点;输入|r=-3会约至千位;输入|r=-6会约至百万位,如此类推。

Formatnum
编辑

为达到更佳效果,编者可以使用{{formatnum:}},用{{Formatprice}}也可。这个功能为数值每三个数位加上一个分隔逗号,但编者不能控制显示多少小数位。

  • Green tickY DM {{formatnum:{{Inflation|DE|1000000|1957|1978}}}}.00 = DM 2,006,102.00
  • Green tickY £{{formatnum:{{Inflation|UK|1000000|1323|1978|r=-4}}}} = £114,610,000
  • Green tickY ${{formatnum:{{Inflation|US|1000000|1990|r=2}}}} = $2,332,144.68
已隐藏部分未翻译内容,欢迎参与翻译

Another potential source of difficulties resides in the way certain calculated values are expressed. In many cases the result comes as a number in engineering units ("1.2E+9" instead of "1200000000"), and when that happens {{formatnum:}}'ing the result fails. A workaround then is to express the value to be inflated with fewer digits, adding a multiplier text such as "million" after the result, and then hitting the "Show preview" button as many times as needed, changing parameters until the best result is found:

  • Red XN ${{formatnum:{{Inflation|US|1000000000|1900|r=-8}}}} = $36,600,000,000
  • Red XN ${{formatnum:{{Inflation|US|1000000|1900|r=-5}}}} thousand = $36,600,000 thousand
  • Green tickY ${{formatnum:{{Inflation|US|1000|1900|r=-2}}}} million = $36,600 million
  • Green tickY ${{formatnum:{{Inflation|US|1|1900|r=1}}}} billion = $36.6 billion

The following section provides an automated way of avoiding this trial and error scenario.

Formatprice
编辑

{{Formatprice}} is a template specifically designed to display price values, both big and small, in a more pleasant way than {{formatnum:}} allows for. For example, instead of showing the whole of a huge number such as "953,783,409,856.12", it would show it as "9538亿", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "1.23千".

On the down side, {{Formatprice}} has no built-in intelligent handling of user locale settings, which means that some users might see a dot or a comma the opposite way they'd expect. As a general rule of thumb this shouldn't be a serious concern though, as most numbers in Wikipedia are hand-written anyway and will show as entered regardless of user settings.

Documenting
编辑

It's a good practice to provide a valid reference for the prices calculated with this template in the articles where it's used. The template {{Inflation/fn|country}} was developed to ease this task. It accepts as its single parameter the same country codes used here, and will generate one or more appropriate footnotes. Typically, this is how a piece of text using it looks like:

  • In 1910 a ''blah'' cost on average £1,000. This is equivalent to £{{Formatprice|{{Inflation|UK|1000|1910|r=2}}}} in present day terms.{{Inflation/fn|UK}}

Resulting in this converted code (notice the footnote link at the end):

  • In 1910 a blah cost on average £1,000. This is equivalent to £10.9万 in present day terms.[6]

The footnote thus generated appears whenever {{reflist}} or <references /> is used in an article, usually in its "References" section. See below for the live example in this document's own References section, or click the above generated footnote to jump to it.

Limitations

编辑
  1. Currently it isn't possible to "de-inflate" a value to what it would have been in a previous year. If you need this functionality, please request it at the talk page. Adding it won't be difficult, but there's no point in doing so before someone actually needs it.
  2. Substitution isn't supported at all. Trying to {{subst:Inflation|...}} would only result in a long sequence of embedded parser code without any direct benefit. If you need to obtain an inflated price only once, please use the special ExpandTemplates page then copy the result and paste it at the desired location.

Developer Documentation

编辑

An inflation series represents templates in the following categories:

  • Template:Inflation/name
  • Template:Inflation/name/dataset
  • Template:Inflation/name/startyear
  • Template:Inflation/doc/name (Which is then displayed at Inflation/name/dataset as the documentation, and needs to refer to the original data source)

Modifications need to be made to:

  • Template:Inflation/fn

重定向

编辑

参见

编辑

参考资料

编辑
  1. ^ 1850-1899: McLean, I.W. (1999), Consumer Prices and Expenditure Patterns in Australia 1850–1914. Australian Economic History Review, 39: 1-28. For later years, Australian Consumer Price Inflation figures follow the Long Term Linked Series provided in Australian Bureau of Statistics (2011) 6461.0 – Consumer Price Index: Concepts, Sources and Methods, 2011 as explained at §§3.10–3.11; this series comprises "from 1901 to 1914, the A Series Retail Price Index; from 1914 to 1946–47, the C Series Retail Price Index; from 1946–47 to 1948–49, a combination of the C Series Index, excluding rent, and the housing group of the CPI; and from 1948–49 onwards, the CPI." (3.10). Retrieved 2015-05-04
  2. ^ Inflated values automatically calculated using the "3101 Road and bridge construction Australia" series provided in Australian Bureau of Statistics (2014) 6427.0 – Producer Price Indexes, Australia, Mar 2014: Table 17 Output of the Construction industries, subdivision and class index numbers. Retrieved 14 June 2014.
  3. ^ 1688 to 1923: Geloso, Vincent, A Price Index for Canada, 1688 to 1850 (December 6, 2016). Afterwards, Canadian inflation numbers based on Statistics Canada tables 18-10-0005-01 (formerly CANSIM 326-0021) Consumer Price Index, annual average, not seasonally adjusted. Statistics Canada. [2021-04-17].  and table 18-10-0004-13 Consumer Price Index by product group, monthly, percentage change, not seasonally adjusted, Canada, provinces, Whitehorse, Yellowknife and Iqaluit. Statistics Canada. [2021-04-17]. 
  4. ^ 1500 to 1850: Ulrich Pfister, 2010. "Consumer prices and wages in Germany, 1500 - 1850," CQE Working Papers 1510, Center for Quantitative Economics (CQE), University of Muenster. 1851-1882: Coos Santing, 2007, Inflation 1800-2000, data from OECD, Organisation for Economic Co-operation and Development, Economic Outlook. Historical Statistics and Mitchell, B. R. International Historical Statistics, Africa, Asia and Oceania 1750-1993 London : Macmillan ; New York : Stockton, 1998, International Historical Statistics, Europe 1750-1993 London : Macmillan ; New York : Stockton, 1998, and International Historical Statistics, The Americas 1750-1993 London : Macmillan ; New York : Stockton, 1998. After 1883, German inflation numbers based on data available from the Deutsches Statistisches Bundesamt archive and GENESIS database.
  5. ^ 1868 to 1938: Williamson J., Nominal Wage, Cost of Living, Real Wage and Land Rent Data for Japan 1831-1938, 1939 to 1945: Bank of Japan Historical Statistics Afterwards, Japanese Historical Consumer Price Index numbers based on data available from the Japanese Statistics Bureau. Japan Historical Consumer Price Index (CPI) – 1970 to 2014 Retrieved 30 July 2014. For between 1946 and 1970, from 昭和戦後史. [2015-01-24]. 
  6. ^ 6.0 6.1 见英国零售价指数英语Retail Price Index,数据来自Clark, Gregory. The Annual RPI and Average Earnings for Britain, 1209 to Present (New Series). MeasuringWorth. 2017 [2022-06-11]. 
  7. ^ 1634–1699: McCusker, J. J. How Much Is That in Real Money? A Historical Price Index for Use as a Deflator of Money Values in the Economy of the United States: Addenda et Corrigenda (PDF). American Antiquarian Society. 1997.  1700–1799: McCusker, J. J. How Much Is That in Real Money? A Historical Price Index for Use as a Deflator of Money Values in the Economy of the United States (PDF). American Antiquarian Society. 1992.  1800–present: Federal Reserve Bank of Minneapolis. Consumer Price Index (estimate) 1800–. [2024-02-29]. 
  8. ^ Johnston, Louis; Williamson, Samuel H. What Was the U.S. GDP Then?. MeasuringWorth. 2022 [2022-02-12].  United States Gross Domestic Product deflator figures follow the Measuring Worth series.