Шаблон:Inflation/док

С Википедије, слободне енциклопедије

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:

index Country start_year minimum end_year maximum
AU Australia[2] 1901 2010
AU-road Australia [...?][3] 1998 2013
BD Bangladesh[4] 1986 2014
CA Canada[5] 1914 2018
DE Germany[6] 1882 2009
IN India[7] 1953 2018
JP Japan[8] 1946 2019
PH Philippines[9] 1985 2013
PK Pakistan[10] 1960 2013
UK United Kingdom[11] 1209 2018
UKNGDPPC United Kingdom [...?][12] 1830 >Грешка: Недефинисан индекс „UKNGDPPC” при употреби шаблона {{Inflation/year}}.
US United States[13] 1800 2018
US-NGDPPC United States [...?][14] 1790 >Грешка: Недефинисан индекс „US-NGDPPC” при употреби шаблона {{Inflation/year}}.
ZAR South Africa[15] 1960 2016

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[уреди извор]

  • Зелена квачицаД {{Inflation|DE|100|2000}}117
  • Зелена квачицаД {{Inflation|US|595|1982}}1.545
  • Зелена квачицаД {{Inflation|US|595|1982|fmt=eq}}еквивалентно 1,545 долара године 2018
  • Зелена квачицаД {{Inflation|US|800|1942|fmt=eq|r=-3}}еквивалентно 12,000 долара године 2018
  • Зелена квачицаД {{Inflation|US|100|2010|2012|fmt=eq|r=2}}еквивалентно 105,28 долара године 2012
  • Зелена квачицаД 595 долара ({{Inflation|US|595|1982|fmt=eq}})595 долара (еквивалентно 1,545 долара године 2018)
  • Зелена квачицаД 595 долара ({{Inflation|US|595|1982|fmt=eq|cursign=[[Амерички долар|$]]}})595 долара (еквивалентно 1,545 $ године 2018)
  • Зелена квачицаД 21 милион долара (еквивалентно {{Inflation|US|21|2005|r=2}} милион{{plural:{{formatnum:{{Inflation|US|21|2005|r=2}}|R}}||а|а}} долара године {{Inflation-year|US}})21 милион долара (еквивалентно 26,94 милиона долара године 2018)
  • Red XN {{Inflation|UK|1|1323|fmt=eq}}еквивалентно 593 долара године 2018
  • Зелена квачицаД {{Inflation|UK|1|1323|fmt=eq|cursign=£}}еквивалентно 593 £ године 2018
  • Зелена квачицаД {{Inflation|AU|100|2024|fmt=eq}}еквивалентно 100 долара године 2024
  • Зелена квачицаД {{Inflation|US|100|2024}} долар{{plural:{{formatnum:{{Inflation|US|100|2024}}|R}}||а|а}} године {{Inflation-year|US}}100 долара године 2018

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 XN 100 долара ({{Inflation|US|595|1982|fmt=c}} долар{{plural:{{formatnum:{{Inflation|US|595|1982|fmt=c}}|R}}||а|а}} данас)595 долара (1.459 долара данас)
  • Red XN 100 долара ({{Inflation|US|595|1982|fmt=c}} долар{{plural:{{formatnum:{{Inflation|US|595|1982|fmt=c}}|R}}||а|а}} године {{CURRENTYEAR}})100 долара (1.459 долара године 2024)
  • Red XN 100 долара ({{Inflation|US|595|1982|fmt=c}} долар{{plural:{{formatnum:{{Inflation|US|595|1982|fmt=c}}|R}}||а|а}} прилагођено за инфлацију)100 долара (1.459 долара прилагођено за инфлацију)
  • Зелена квачицаД 100 долара ({{Inflation|US|595|1982|fmt=eq}})100 долара (еквивалентно 1,545 долара године 2018)
  • Зелена квачицаД 100 долара (еквивалентно {{Inflation|US|595|1982|fmt=c}} долар{{plural:{{formatnum:{{Inflation|US|595|1982|fmt=c}}|R}}||а|а}} године {{Inflation-year|US}})100 долара (еквивалентно 1,545 долара године 2018)
  • Red XN Џејн Доу је стекла богатство од 1 милијарде долара године 1975, чиме је њено богатство {{Inflation|US|1|1975|fmt=c}} милијард{{plural:{{formatnum:{{Inflation|US|1|1975|fmt=c}}|R}}|а|е|и}} долара године {{Inflation-year|US}}.Џејн Доу је стекла богатство од 1 милијарде долара године 1975, чиме је њено богатство 5 милијарди долара године 2018.
  • Red XN Џејн Доу је стекла богатство од 1 милијарде долара године 1975, еквивалентно {{Inflation|US|1|1975|fmt=c}} милијард{{plural:{{formatnum:{{Inflation|US|1|1975|fmt=c}}|R}}|а|е|и}} долара године {{Inflation-year|US}}.Џејн Доу је стекла богатство од 1 милијарде долара године 1975, еквивалентно 5 милијарди долара године 2018.

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

  • Red XN {{Inflation}}Грешка при употреби шаблона {{Inflation}}: |index= (параметар 1), |value= (параметар 2) и |start_year= (параметар 3) мора да се попуни.
  • Red XN {{Inflation|abc}}Грешка при употреби шаблона {{Inflation}}: |value= (параметар 2) и |start_year= (параметар 3) мора да се попуни.
  • Red XN {{Inflation|AU}}Грешка при употреби шаблона {{Inflation}}: |value= (параметар 2) и |start_year= (параметар 3) мора да се попуни.
  • Red XN {{Inflation|AU|100}}Грешка при употреби шаблона {{Inflation}}: |start_year= (параметар 3) мора да се попуни.
  • Red XN {{Inflation|abc|€100|1980}}Грешка при употреби шаблона {{Inflation}}: |index=abc (параметар 1) није препознат као индекс.
  • Red XN {{Inflation|DE|€100|1980}}Грешка при употреби шаблона {{Inflation}}: NaN, проверити параметре и уклонити ненумеричке вредности: |value=€100 (параметар 2).
  • Red XN {{Inflation|DE|€100|zzzz|zzzz|r=zzzz}}Грешка при употреби шаблона {{Inflation}}: NaN, проверити параметре и уклонити ненумеричке вредности: |value=€100 (параметар 2), |start_year=zzzz (параметар 3), |end_year=zzzz (параметар 4) и |r=zzzz.
  • Red XN {{Inflation|AU|100|1200|2025}}Грешка при употреби шаблона {{Inflation}}: |start_year=1200 (параметар 3) је мањи од најраније доступне године (1901) у индексу „AU” и |end_year=2025 (параметар 4) је већи од најкасније доступне године (2010) у индексу „AU”.
  • Red XN {{Inflation|AU|100|2005|2004}}Грешка при употреби шаблона {{Inflation}}: |start_year=2005 (параметар 3) је већи од |end_year=2004 (параметар 4).
  • Red XN {{Inflation|AU|100|2005|2025|fmt=eq}}Грешка при употреби шаблона {{Inflation}}: |end_year=2025 (параметар 4) је већи од најкасније доступне године (2010) у индексу „AU”.
  • Red XN {{Inflation|AU|100|2024|2025|fmt=eq}}Грешка при употреби шаблона {{Inflation}}: |end_year=2025 (параметар 4) је већи од најкасније доступне године (2010) у индексу „AU”.
  • Red XN {{Inflation|AU|100|2024|1905|fmt=eq}}Грешка при употреби шаблона {{Inflation}}: |start_year=2024 (параметар 3) је већи од |end_year=1905 (параметар 4).
  • Red XN {{Inflation|AU|100|2025|fmt=eq}}Грешка при употреби шаблона {{Inflation}}: |start_year=2025 (параметар 3) је већи од најкасније доступне године (2010) у индексу „AU”.

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 (4.046,74) 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:

  • Зелена квачицаД {{#expr:({{formatnum:{{Inflation|DE|1.000|1.960|r=2}}|R}} / 1.95583) round 2}}2.069,07

За урадити 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:

  • Зелена квачицаД ${{Inflation|US|1000000000000|1900|r=-11|fmt=c}}$30,100,000,000,000
  • Red XN ${{Inflation|US|10000000000000|1900|r=-12|fmt=c}}$301,000,000,000,000
  • Red XN ${{Inflation|US|10000000000|1900|r=-9|fmt=c}} хиљада$301,000,000,000 хиљада
  • Зелена квачицаД ${{Inflation|US|10000000|1900|r=-6|fmt=c}} милиона$301,000,000 милиона
  • Зелена квачицаД ${{Inflation|US|10000|1900|r=-3|fmt=c}} милијарди$301,000 милијарди
  • Зелена квачицаД ${{Inflation|US|10|1900|fmt=c}} билиона$301 билиона

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 милијарде", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "1,23 хиљаде".

  • Зелена квачицаД ${{Format price|{{formatnum:{{Inflation|US|10000000000000|1900}}}}}}$301 билион
  • Зелена квачицаД ${{Format price|{{formatnum:{{Inflation|US|1000000|1990}}|R}}}}$1,92 милиона
  • Зелена квачицаД DM {{Format price|{{formatnum:{{Inflation|DE|1000000|1957|1978}}|R}}}}DM 2,01 милион
  • Зелена квачицаД £{{Format price|{{formatnum:{{Inflation|UK|1000|1323}}|R}}}}£593 хиљаде

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 еквивалентно 2,423 долара године 2018.[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: Inflation

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, 2023, others up to roughly June-July 2023, and others yet up to December 31, 2022.
  2. ^ 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 May 4, 2015
  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.[нејасно ]
  5. ^ Canadian inflation numbers based on Statistics Canada. "Consumer Price Index, historical summary". CANSIM, table (for fee) 326-0021 and Catalogue nos. 62-001-X, 62-010-X and 62-557-X. And Consumer Price Index, by province (monthly) (Canada) Last modified 2016-01-22. Retrieved March 2, 2016
  6. ^ German inflation numbers based on data available from Deutsches Statistisches Bundesamt.
  7. ^ Historic inflation India - CPI inflation, Inflation.eu, Приступљено 25. мај 2016 
  8. ^ 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 „昭和戦後史”. Приступљено 24. јануар 2015. 
  9. ^ Consumer Price Index,Inflation Rate and Purchasing Power of the Peso (national averages)
  10. ^ Pakistan - Consumer price index, International Monetary Fund, International Financial Statistics and data files.[нејасно ]
  11. ^ UK CPI inflation numbers based on data available from Gregory Clark (2016), "The Annual RPI and Average Earnings for Britain, 1209 to Present (New Series)" MeasuringWorth.
  12. ^ United Kingdom nominal Gross Domestic Product per capita figures follow the Measuring Worth series supplied in Lawrence H. Officer (2011), "What Was the U.K. GDP Then?" MeasuringWorth. These figures represent the figures prior to the update to the Blue Book in October 2011.
  13. ^ а б Federal Reserve Bank of Minneapolis Community Development Project. „Consumer Price Index (estimate) 1800–”. Federal Reserve Bank of Minneapolis. Приступљено 21. октобар 2016. 
  14. ^ United States nominal Gross Domestic Product per capita figures follow the Measuring Worth series supplied in Johnston, Louis; Williamson, Samuel H. (2016). „What Was the U.S. GDP Then?”. MeasuringWorth. Приступљено 10. април 2016.  These figures follow the figures as of 2015.
  15. ^ South Africa - Consumer price index, International Monetary Fund, International Financial Statistics and data files.[нејасно ]


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-NGDPPC or UKNGDPPC indexes should be used, which calculate inflation of the Nominal Gross Domestic Product per capita for the United States and United Kingdom, respectively.

Параметри шаблона

Овај шаблон преферира форматирање параметара у једном реду.

ПараметарОписВрстаСтатус
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, UKNGDPPC, US, US-NGDPPC, ZAR.

Пример
US
текстобавезно
Valuevalue 2

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

Пример
1000
бројобавезно
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.

Пример
1975
бројобавезно
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.

Пример
2015
бројнеобавезно
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.

Подразумевано
0
Пример
1
бројнеобавезно
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.

Пример
eq
текстнеобавезно
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 $.

Подразумевано
$
Пример
текстнеобавезно