Bước tới nội dung

Bản mẫu:Inflation/doc

Bách khoa toàn thư mở Wikipedia

This template calculates inflation based on several inflation index data sets. The template uses an identification code for an inflation index (usually a country code), an original value, an original start_year and either a specific reference end_year or by default the latest currently available end year,[1] and calculates the equivalent value from historical economic changes between the original and reference years. For example, this template calls the United States inflation table located in the sub-template Template:Inflation/US/dataset to perform the U.S. calculation.

Aside from a convenient way to calculate values from different specified time periods, this template allows a regularly automatically updated calculation of value based on the most recent available inflation data. Whenever inflation tables are updated, potentially annually, all articles using this template have their displayed values updated accordingly.

Usage

{{Inflation|index|value|start_year}}{{Inflation|index|value|start_year|end_year}}{{Inflation|index|value|start_year|r=decimals|fmt=c}}{{Inflation|index|value|start_year|r=decimals|fmt=eq}}{{Inflation|index|value|start_year|r=decimals|fmt=eq|cursign=X}}

The supported countries are listed below, with their index and available data periods:

indexCountrystart_year minimumend_year maximum
AUAustralia[2]18502022
AU-roadAustralia [...?][3]Bản mẫu:Inflation/AU-road/startyear2018
BDBangladesh[4]Bản mẫu:Inflation/BD/startyear2022
CACanada[5]Bản mẫu:Inflation/CA/startyear2021
DEĐức[6]18822021
INIndia[7]19532023
JPJapan[8]19462019
PHPhilippines[9]Bản mẫu:Inflation/PH/startyear2021
PKPakistan[10]Bản mẫu:Inflation/PK/startyear2021
UKUnited Kingdom[11]12092023
UK-GDPUnited Kingdom GDP deflator[12]Bản mẫu:Inflation/UK-GDP/startyear2019
USUnited States[13]18002022
US-GDPUnited States GDP deflator[14]17902022
ZARSouth Africa[15]Bản mẫu:Inflation/ZAR/startyear2018
KRWSouth Korea[16]Bản mẫu:Inflation/KRW/startyear2017

Parameters

  • |index= (parameter 1), required, an index code for one of several available inflation indexes.
  • |value= (parameter 2), required, original price or value from which to base the inflation calculation on. Will ignore any commas, but must not have a currency symbol.
  • |start_year= (parameter 3), required, original year from which to base the inflation calculation on. Must be a year available in the chosen inflation index. As an exception to this, if the current year is specified and no end_year is specified, the template will output value unchanged, as it can be assumed an inflation of zero.
  • |end_year= (parameter 4), optional, reference year for which to calculate inflation. Must be higher (later) than start_year, but not higher than the highest (most recent) year available in the chosen inflation index, and will default to the highest (most recent) available year if omitted.
  • |r=digit sets the digits to which the value must be rounded. A negative value indicates rounding to an upper significant digit, and a positive value indicates a fractional digit including trailing zeros. Defaults to 0, i.e., without cents.
  • |fmt=c will insert thousands separator commas into the calculated value.
  • |fmt=eq will show an equivalent-to phrase, in the format, "equivalent to cursignend_value in end_year". Uses thousands separator commas.
    • |cursign= will set the currency symbol to be shown. Only functions when |fmt=eq is used. Can use advanced symbol formats, but can only precede the calculated value. Default is $.

Examples

  • Green tick {{Inflation|DE|100|2000}}68
  • Green tick {{Inflation|US|595|1982}}1939
  • Green tick {{Inflation|US|595|1982|fmt=eq}}tương đương $1.939 vào năm 2026
  • Green tick {{Inflation|US|800|1942|fmt=eq|r=-3}}tương đương $15.000 vào năm 2026
  • Green tick {{Inflation|US|100|2010|2012|fmt=eq|r=2}}tương đương $105,28 vào năm 2012
  • Green tick US$595 ({{Inflation|US|595|1982|fmt=eq}})US$595 (tương đương $1.939 vào năm 2026)
  • Green tick US$595 ({{Inflation|US|595|1982|fmt=eq|cursign=[[United States dollar|US$]]}})US$595 (tương đương US$1.939 vào năm 2026)
  • Green tick $21 million (equivalent to ${{Inflation|US|21|2005|r=2}} million in {{Inflation/year|US}})$21 million (equivalent to $33.81 million in 2022)
  • Green tick {{Inflation|UK|1|1209}}tương đương £1.672 vào năm 2026
  • Green tick {{Inflation|AU|100|2026|fmt=eq}}Lỗi: Không có dữ liệu CPI năm 2026
  • Green tick ${{Inflation|US|100|2026}} in {{Inflation/year|US}}$Lỗi: Không có dữ liệu CPI năm 2026 in 2022

It is possible to use the template in incorrect ways without producing error messages. Please read the warnings and appropriate uses of this template at the beginning of the template description.

  • Red X {{Inflation|UK|10|1971|fmt=eq}}tương đương $168 vào năm 2026 (Omitting the |cursign= parameter will show the $ symbol by default, which is the wrong currency symbol for British currency)
  • Green tick {{Inflation|UK|10|1971|fmt=eq|cursign=£}}tương đương £168 vào năm 2026
  • Red X $595 (${{Inflation|US|595|1982|fmt=c}} today)$595 ($1.939 today) (Misleading time reference)
  • Red X $595 (${{Inflation|US|595|1982|fmt=c}} in {{CURRENTYEAR}})$595 ($1.939 in 2026) (Misleading time reference)
  • Red X $100 (${{Inflation|US|595|1982|fmt=c}} adjusted for inflation)$100 ($1.939 adjusted for inflation) (Misleading time reference)
  • Green tick $595 ({{Inflation|US|595|1982|fmt=eq}})$595 (tương đương $1.939 vào năm 2026)
  • Green tick $595 (equivalent to ${{Inflation|US|595|1982|fmt=c}} in {{Inflation/year|US}})$595 (equivalent to $1.939 in 2022)
  • Red X Jane Doe amassed a fortune of $1 billion in 1975, making her worth ${{Inflation|US|1|1975|fmt=c}} billion in {{Inflation/year|US}}.Jane Doe amassed a fortune of $1 billion in 1975, making her worth $6 billion in 2022. (CPI is not for personal wealth of the wealthy – use GDP deflator instead)
  • Red X Jane Doe amassed a fortune of $1 billion in 1975, equivalent to ${{Inflation|US|1|1975|fmt=c}} billion in {{Inflation/year|US}}.Jane Doe amassed a fortune of $1 billion in 1975, equivalent to $6 billion in 2022. (CPI is not for personal wealth of the wealthy – use GDP deflator instead)
  • Green tick Jane Doe amassed a fortune of $1 billion in 1975, equivalent to ${{Inflation|US-GDP|1|1975|fmt=c}} billion in {{Inflation/year|US-GDP}}.Jane Doe amassed a fortune of $1 billion in 1975, equivalent to $4 billion in 2022

Entering invalid parameters or omitting required parameters will result in an error message and categorization into Category:Pages with errors in inflation template.

  • Red X {{Inflation}}Lỗi: Thiếu tham số giá trị hoặc năm bắt đầu
  • Red X {{Inflation|abc}}Lỗi: Thiếu tham số giá trị hoặc năm bắt đầu
  • Red X {{Inflation|AU}}Lỗi: Thiếu tham số giá trị hoặc năm bắt đầu
  • Red X {{Inflation|AU|100}}Lỗi: Thiếu tham số giá trị hoặc năm bắt đầu
  • Red X {{Inflation|abc|€100|1980}}Lỗi: Thiếu tham số giá trị hoặc năm bắt đầu
  • Red X {{Inflation|DE|€100|1980}}Lỗi: Thiếu tham số giá trị hoặc năm bắt đầu
  • Red X {{Inflation|DE|€100|zzzz|zzzz|r=zzzz}}Lỗi: Thiếu tham số giá trị hoặc năm bắt đầu
  • Red X {{Inflation|AU|100|1200|2027}}Lỗi: Không có dữ liệu CPI năm 1200
  • Red X {{Inflation|AU|100|2005|2004}}97
  • Red X {{Inflation|AU|100|2005|2027|fmt=eq}}tương đương $144 vào năm 2027
  • Red X {{Inflation|AU|100|2026|2027|fmt=eq}}Lỗi: Không có dữ liệu CPI năm 2026
  • Red X {{Inflation|AU|100|2026|1905|fmt=eq}}Lỗi: Không có dữ liệu CPI năm 2026
  • Red X {{Inflation|AU|100|2027|fmt=eq}}Lỗi: Không có dữ liệu CPI năm 2027

Tips & tricks

Currency conversion

This template is currency agnostic, which means it doesn't convert between different currencies. Thus, if you wanted to know how much DM 1,000.00 marks in 1960 are worth nowadays, entering {{Inflation|DE|1000|1960|r=2}} would provide a result (2367.51) still in marks, not in euros.

Consequently, if you need a result in another currency than the one in which the original value is stated, for now you must do the conversion manually, as in the following example which uses the defined conversion rate of € 1 = DM 1.95583:

  • Green tick {{#expr:({{Inflation|DE|1000|1960|r=2}} / 1.95583) round 2}}1210.49

 Việc cần làm A currency conversion template to ease these conversion tasks is planned. This section will be updated accordingly once it's developed.

Rounding

By default the values are calculated to the unit, as for all but very low values cents are undesirable. You can specify rounding with the |r= parameter which determines the number of decimals. To obtain cents use |r=2, but other values can be used, including negative ones: |r=-3, for example, will round to the nearest thousand, |r=-6 to the nearest million, and so on. It is advisable to avoid excessive precision; even if the start value is known to be exact, the template's result will not be because the inflation index tables are rarely accurate to more than about 1%, and a granularity of whole years is used.

Very large results

Very large results are expressed in scientific notation ("1.2E+14" instead of "120000000000000") which is normally not desirable. A workaround is to express the value to be inflated with fewer digits, adding a multiplier text such as "trillion" after the result, using the "Show preview" button as many times as needed, changing parameters until the best result is found:

  • Green tick ${{Inflation|US-GDP|1000000000000|1900|r=-11|fmt=c}}$30.100.000.000.000
  • Red X ${{Inflation|US-GDP|10000000000000|1900|r=-12|fmt=c}}$301.000.000.000.000
  • Red X ${{Inflation|US-GDP|10000000000|1900|r=-9|fmt=c}} thousand$301.000.000.000 thousand
  • Green tick ${{Inflation|US-GDP|10000000|1900|r=-6|fmt=c}} million$301.000.000 million
  • Green tick ${{Inflation|US-GDP|10000|1900|r=-3|fmt=c}} billion$301.000 billion
  • Green tick ${{Inflation|US-GDP|10|1900|fmt=c}} trillion$301 trillion

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

Format price

{{Format price}} is a template specifically designed to display price values, both big and small, in a readable way. For example, instead of showing the whole of a huge number such as "953,783,409,856.12", it would show it as "954 tỷ", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "1,23 nghìn".

  • Green tick ${{Format price|{{Inflation|US-GDP|10000000000000|1900}}}}$301 nghìn tỷ
  • Green tick ${{Format price|{{Inflation|US-GDP|1000000|1990}}}}$2,06 triệu
  • Green tick DM {{Format price|{{Inflation|DE|1000000|1957|1978}}}}DM 2,01 triệu
  • Green tick £{{Format price|{{Inflation|UK-GDP|1000|1323}}}}£780 nghìn

Documenting

It's a good practice to provide a valid reference for the prices calculated with this template in articles where it's used. The template {{Inflation/fn}} 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 1985 a unit cost on average $1,040. This is {{Inflation|US|1040|1985|fmt=eq}}}}.{{Inflation/fn|US}}

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

  • In 1985 a unit cost on average $1,040. This is tương đương $3.041 vào năm 2026.[13]

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/index
  • Template:Inflation/index/dataset
  • Template:Inflation/index/startyear
  • Template:Inflation/doc/index (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:

Current subpages:

TemplateData

Đây là tài liệu Dữ liệu bản mẫu cho bản mẫu này được sử dụng bởi Trình soạn thảo trực quan và các công cụ khác; xem báo cáo sử dụng tham số hàng tháng cho bản mẫu này.

Dữ liệu bản mẫu cho Inflation

This template calculates inflation based on several inflation index data sets. Note that this template defaults to calculating the inflation of Consumer Price Index values: staples, workers' rent, small service bills (doctor's costs, train tickets). For inflating capital expenses, government expenses, or the personal wealth and expenditure of the rich, the US-GDP or UK-GDP indexes should be used, which calculate inflation based on the [[gross domestic product]] (GDP) for the [[United States]] and [[United Kingdom]], respectively.

Tham số bản mẫu

Nên dùng bản mẫu này với các tham số đặt trên cùng một hàng.

Tham sốMiêu tảKiểuTrạng thái
Indexindex 1

An index code for one of several available inflation indexes. One of AU, AU-road, BD, CA, DE, IN, JP, PH, PK, UK, UK-GDP, US, US-GDP, ZAR.

Ví dụ
US
Chuỗi dàibắt buộc
Valuevalue 2

Original price or value from which to base the inflation calculation on. Will ignore any commas.

Ví dụ
1000
Sốbắt buộc
Start yearstart_year 3

Original year from which to base the inflation calculation on. Must be a year available in the chosen inflation index. As an exception to this, if the current year is specified and no 'End year' is specified, the template will output value unchanged, as it can be assumed an inflation of zero.

Ví dụ
1975
Sốbắt buộc
End yearend_year 4

Reference year for which to calculate inflation. Must be higher (later) than 'Start year', but not higher than the highest (most recent) year available in the chosen inflation index, and will default to the highest (most recent) available year if omitted.

Ví dụ
2015
Sốtùy chọn
Number of digitsr

Sets the digits to which the value must be rounded. A negative value indicates rounding to an upper significant digit, and a positive value indicates a fractional digit including trailing zeros. Defaults to 0.

Mặc định
0
Ví dụ
1
Sốtùy chọn
Formatfmt

"c" will insert thousands separator commas into the calculated value. "eq" will show an equivalent-to phrase, in the format, "equivalent to (cursign)(end_value) in (end_year)". Uses thousands separator commas.

Ví dụ
eq
Chuỗi dàitùy chọn
Currency signcursign

Sets the currency symbol to be shown. Only functions when Format "eq" is used. Can use advanced symbol formats, but can only precede the calculated value. Default is $.

Mặc định
$
Ví dụ
Chuỗi dàitùy chọn

See also

References

  1. How recently depends on how the data set for each country is constructed, and on the internal tables being updated accordingly every January. Some data tables provide inflation data up to December 31, 2025, others up to roughly June-July 2025, and others yet up to December 31, 2024.
  2. AU = 1850-1901: McLean, I.W. (1999), Consumer Prices and Expenditure Patterns in Australia 1850–1914. Australian Economic History Review, 39: 1-28 (taken W6 series from Table A1, which represents the average inflation in all of Australian colonies). For later years, calculated using the pre-decimal inflation calculator provided by the Reserve Bank of Australia for each year, input: £94 8s (94.40 Australian pounds in decimal values), start year: 1901.
  3. 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.
  4. Bangladesh – Consumer price index, International Monetary Fund, International Financial Statistics and data files.[Còn mơ hồ ]
  5. 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. Truy cập ngày 17 tháng 4 năm 2021. 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. Truy cập ngày 17 tháng 4 năm 2021.
  6. 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.
  7. 1595 to 1872: Bob Allen, Prices and Wages in India, 1595-1930 1873 to 1919: Williamson J., Real Wages and Relative Factor Prices in the Third World 1820-1940: Asia. 2000, Appendix 2 Nominal Wage, Cost of Living and Real Wage Data for India 1873-1939 and Land Prices for the Punjab 1871-1939, 1920 to 1953: 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, 1954 to 2023: Historic inflation India – CPI inflation, Inflation.eu, truy cập ngày 8 tháng 7 năm 2023
  8. 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 "昭和戦後史". Truy cập ngày 24 tháng 1 năm 2015.
  9. 1899 to 1938: Williamson J., Real Wages and Relative Factor Prices in the Third World 1820-1940: Asia, Nominal Wage, Cost of Living and Real Wage Data for the Philippines 1899-1940 1949 to 1958: 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. Afterwards, Consumer Price Index,Inflation Rate and Purchasing Power of the Peso (national averages)
  10. Dữ liệu được lấy từ World Development Indicators (ngày 19 tháng 3 năm 2021). "Claims on central government, etc. (% GDP)". World Bank.
  11. UK Retail Price Index inflation figures are based on data from Clark, Gregory (2017). "The Annual RPI and Average Earnings for Britain, 1209 to Present (New Series)". MeasuringWorth. Truy cập ngày 11 tháng 6 năm 2022.
  12. United Kingdom Gross Domestic Product deflator figures follow the Measuring Worth "consistent series" supplied in Thomas, Ryland; Williamson, Samuel H. (2018). "What Was the U.K. GDP Then?". MeasuringWorth. Truy cập ngày 2 tháng 2 năm 2020.
  13. 1 2 Cụm nguồn chỉ số giá cả lạm phát tại Hoa Kỳ:
  14. Johnston, Louis; Williamson, Samuel H. (2023). "What Was the U.S. GDP Then?". MeasuringWorth. Truy cập ngày 30 tháng 11 năm 2023. United States Gross Domestic Product deflator figures follow the Measuring Worth series.
  15. South Africa – Consumer price index, International Monetary Fund, International Financial Statistics and data files.[Còn mơ hồ ]
  16. 1906 to 1911: Williamson J. (1999), Nominal Wage, Cost of Living, Real Wage and Land Rent Data for Korea 1906-1939 1912 to 1939: Mizoguchi, T. (1972). Consumer Prices and Real Wages in Taiwan and Korea Under Japanese Rule. Hitotsubashi Journal of Economics, 13(1), 40-56. Retrieved May 21, 2021. Afterwards, consumer price index from Statistics Korea. Consumer Price Index by year. Retrieved 3 April 2018