మూస:Inflation/doc
This is a documentation subpage for మూస:Inflation. It may contain usage information, categories and other content that is not part of the original మూస page. |
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 possess it, please consult someone with economic training before making use of this. |
This మూస employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
This template takes a country_code
, for example, "US
" for the United States or "UK
" for United Kingdom, a value
in that country's currency, a start_year
, and applies to it the country's consumer price inflation until "recently" or another end year.[1] For example, this template calls the U.S. inflation table located in the sub-template Template:Inflation/US/dataset to perform the U.S. calculation. This means that whenever a new year arrives and the inflation tables are updated, all articles using this template have their displayed values updated accordingly.
Alternatively, you can provide a second, optional end_year
parameter, and the value will be inflated for the period between the two years, providing a convenient way of getting values from different time periods adjusted around the same date.
Usage
మార్చు{{Inflation|country_code|value|start_year}}
{{Inflation|country_code|value|start_year|end_year}}
{{Inflation|country_code|value|start_year|r=decimals|fmt=c}}
{{Inflation|country_code|value|start_year|r=decimals|fmt=eq}}
{{Inflation|country_code|value|start_year|r=decimals|fmt=eq|cursign=X}}
The supported countries are listed below, with their country_code and minimum start_year:
Country name | country_code |
minimum for start_year
|
---|---|---|
Australiaమూస:Inflation-fn | AU | 1901 |
Canadaమూస:Inflation-fn | CA | 1916 |
Germanyమూస:Inflation-fn | DE | 1882 |
Indiaమూస:Inflation-fn | IN | 1953 |
Japanమూస:Inflation-fn | JP | 1970 |
United Kingdomమూస:Inflation-fn | UK | 1264 |
United Statesమూస:Inflation-fn | US | 1800 |
Parameters
మార్చు- country_code (parameter 1) can be: AU, CA, DE, UK, US, UKNGDPPC, etc.
- value (parameter 2) can have commas, but no currency symbol.
- start_year (parameter 3) depends on years allowed for each country.
- end_year (parameter 4), if provided, must be higher (later) than start_year, but not higher than the current year, and will default to "recently" if left out;
- r=digit sets the digit in which the value must be rounded, defaulting to "0" if unspecified, i.e., without cents (see Tips & Tricks below for details on how to use this parameter).
- fmt=c will insert commas into the inflated value.
- fmt=eq will show an equivalent-to phrase.
- cursign=X will set the currency symbol when 'fmt=eq' is used (default: $).
Examples
మార్చు-
= Error when using {{Inflation}}:{{Inflation|US|595|1982}}
|index=US
(parameter 1) not a recognized index. -
US $595 ($
= US $595 ($Error when using {{Inflation}}:{{Inflation|US|595|1982|fmt=c}}
today)|index=US
(parameter 1) not a recognized index. today) -
US $595 (
= US $595 (Error when using {{Inflation}}:{{Inflation|US|595|1982|fmt=eq}}
)|index=US
(parameter 1) not a recognized index.) -
= Error when using {{Inflation}}:{{Inflation|US|800|1942|r=-3|fmt=eq}}
|index=US
(parameter 1) not a recognized index. -
= Error when using {{Inflation}}:{{Inflation|US|100|2010|2012|r=2|fmt=eq}}
|index=US
(parameter 1) not a recognized index. -
{{Inflation|UK|1|1323|fmt=eq}}
= Error when using {{Inflation}}:|index=UK
(parameter 1) not a recognized index. -
{{Inflation|UK|1|1323|fmt=eq|cursign=£}}
= Error when using {{Inflation}}:|index=UK
(parameter 1) not a recognized index. -
{{Inflation|DE|100|2000}}
= Error when using {{Inflation}}:|index=DE
(parameter 1) not a recognized index.
Entering invalid parameters will result in a link to the NaN article:
-
{{Inflation}}
= Error when using {{Inflation}}:|index=
(parameter 1),|value=
(parameter 2) and|start_year=
(parameter 3) must be specified. -
{{Inflation|abc}}
= Error when using {{Inflation}}:|value=
(parameter 2) and|start_year=
(parameter 3) must be specified. -
{{Inflation|DE|1000000}}
= Error when using {{Inflation}}:|start_year=
(parameter 3) must be specified. -
{{Inflation|US|1000000|1200|3000}}
= Error when using {{Inflation}}:|index=US
(parameter 1) not a recognized index. -
{{Inflation|UK|1000000|2005|2004}}
= Error when using {{Inflation}}:|index=UK
(parameter 1) not a recognized index.
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 (Error when using {{Inflation}}: |index=DE
(parameter 1) not a recognized index.) 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:(
= సమాసంలో (Expression) లోపం: < పరికర్తను (operator) ఊహించలేదు{{Inflation|DE|1000|1960|r=2}}
/ 1.95583) round 2}}
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:
-
$
= $Error when using {{Inflation}}:{{Inflation|US|1000000000000|1900|r=-11|fmt=c}}
|index=US
(parameter 1) not a recognized index. -
$
= $Error when using {{Inflation}}:{{Inflation|US|10000000000000|1900|r=-12|fmt=c}}
|index=US
(parameter 1) not a recognized index. -
$
= $Error when using {{Inflation}}:{{Inflation|US|10000000000|1900|r=-9|fmt=c}}
thousand|index=US
(parameter 1) not a recognized index. thousand -
$
= $Error when using {{Inflation}}:{{Inflation|US|10000000|1900|r=-6|fmt=c}}
million|index=US
(parameter 1) not a recognized index. million -
$
= $Error when using {{Inflation}}:{{Inflation|US|10000|1900|r=-3|fmt=c}}
billion|index=US
(parameter 1) not a recognized index. billion -
$
= $Error when using {{Inflation}}:{{Inflation|US|10|1900|fmt=c}}
trillion|index=US
(parameter 1) not a recognized index. trillion
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 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 "మూస:Formatprice", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "మూస:Formatprice".
-
${{Formatprice|
= $మూస:Formatprice{{Inflation|US|10000000000000|1900}}
}} -
${{Formatprice|
= $మూస:Formatprice{{Inflation|US|1000000|1990}}
}} -
DM {{Formatprice|
= DM మూస:Formatprice{{Inflation|DE|1000000|1957|1978}}
}} -
£{{Formatprice|
= £మూస:Formatprice{{Inflation|UK|1000|1323}}
}}
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 Error when using {{Inflation}}:
|index=US
(parameter 1) not a recognized index..మూస:Inflation-fn
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
మార్చు- 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.
- 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
See also
మార్చు- {{Inflation-fn}}
- {{Formatprice}}
- Inflation
- Consumer price index
- Harmonised Index of Consumer Prices
- List of country codes
- List of circulating currencies
- United States Consumer Price Index
- Consumer Price Index (United Kingdom)
References
మార్చు- ↑ 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.