ढाँचा:Inflation
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 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".[१] 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|r=digit}}
{{Inflation|country_code|value|start_year|end_year|r=digit}}
The supported countries are listed below, with their country_code and minimum start_year:
Country name | country_code | minimum for start_year |
---|---|---|
Australia[२] | AU | 1901 |
Canada[३] | CA | 1916 |
Germany[४] | DE | 1882 |
United Kingdom[५] | UK | 1264 |
United States[६] | US | 1800 |
- end_year, 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).
Examples:
-
{{Inflation|DE|1000000|2000}}
= Error when using {{Inflation}}:|index=DE
(parameter 1) not a recognized index. -
{{Inflation|US|1000000|2001|2001}}
= Error when using {{Inflation}}:|index=US
(parameter 1) not a recognized index. -
{{Inflation|US|1000000|1990|2005|r=2}}
= Error when using {{Inflation}}:|index=US
(parameter 1) not a recognized index. -
{{Inflation|UK|1000000|1323|1978|r=-3}}
= Error when using {{Inflation}}:|index=UK
(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:(
{{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 most huge values cents are undesirable. If you need a different precision you can provide the |r=
parameter to determine in which digit the rounding must happen. To obtain cents you'd 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 and so forth.
Formatnum
[सम्पादन गर्नुहोस्]For a better visualization you can format the returned value using either the internal {{formatnum:}} magic word, or the alternative {{Formatprice}}
template (see below). Each method has its advantages and disadvantages.
{{formatnum:}} is the standard method for formatting numbers in MediaWiki. It adds thousands and decimal separators according to the user settings, and works well for raw numbers composed of up to 15 digits and a dot. On the other hand, it doesn't allow one to set how many digits must be shown after the decimal dot. Thus, a calculated value of "1234.5" will appear as "१,२३४.५", not the expected "1,234.50", making it better suited for integer prices unless the value is known and you can add the missing zeros by hand:
- DM {{formatnum:
{{Inflation|DE|1000000|1957|1978}}
}}.00 = DM Error when using &#१२३;&#१२३;Inflation&#१२५;&#१२५;:&#१२४;index&#६१;DE
(parameter १) not a recognized index..00 - £{{formatnum:
{{Inflation|UK|1000000|1323|1978|r=-4}}
}} = £Error when using &#१२३;&#१२३;Inflation&#१२५;&#१२५;:&#१२४;index&#६१;UK
(parameter १) not a recognized index. - ${{formatnum:
{{Inflation|US|1000000|1990|r=2}}
}} = $Error when using &#१२३;&#१२३;Inflation&#१२५;&#१२५;:&#१२४;index&#६१;US
(parameter १) not a recognized index.
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 less 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:
- ${{formatnum:
{{Inflation|US|1000000000|1900|r=-8}}
}} = $Error when using &#१२३;&#१२३;Inflation&#१२५;&#१२५;:&#१२४;index&#६१;US
(parameter १) not a recognized index. - ${{formatnum:
{{Inflation|US|1000000|1900|r=-5}}
}} thousand = $Error when using &#१२३;&#१२३;Inflation&#१२५;&#१२५;:&#१२४;index&#६१;US
(parameter १) not a recognized index. thousand - ${{formatnum:
{{Inflation|US|1000|1900|r=-2}}
}} million = $Error when using &#१२३;&#१२३;Inflation&#१२५;&#१२५;:&#१२४;index&#६१;US
(parameter १) not a recognized index. million - ${{formatnum:
{{Inflation|US|1|1900|r=1}}
}} billion = $Error when using &#१२३;&#१२३;Inflation&#१२५;&#१२५;:&#१२४;index&#६१;US
(parameter १) not a recognized index. 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 "954 बिलियन", 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.
- DM {{Formatprice|
{{Inflation|DE|1000000|1957|1978}}
}} = DM NaN - £{{Formatprice|
{{Inflation|UK|1000000|1323|1978|r=-4}}
}} = £NaN - ${{Formatprice|
{{Inflation|US|1000000|1990|r=2}}
}} = $NaN - ${{Formatprice|
{{Inflation|US|1000000000|1900|r=-8}}
}} = $NaN
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}} 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):
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 countries is constructed, and on the internal tables being updated accordingly every January. Some data tables provide inflation data up to December 31, अभिव्यक्ति त्रुटि: अज्ञात विराम चिन्ह चरित्र "२"।, others up to roughly June-July अभिव्यक्ति त्रुटि: अज्ञात विराम चिन्ह चरित्र "२"।, and others yet up to December 31, अभिव्यक्ति त्रुटि: अज्ञात विराम चिन्ह चरित्र "२"।.
- ↑ Australian Consumer Price Inflation figures follow the Long Term Linked Series provided in Australian Bureau of Statistics (2009) 6461.0 - Consumer Price Index: Concepts, Sources and Methods, 2009 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)
- ↑ Canadian inflation numbers based on data available from Consumer Price Index, by province (monthly) (Canada) Statistics Canada. Retrieved August 21, 2011 and Consumer Price Index, historical summary Statistics Canada. Retrieved December 7, 2010
- ↑ German inflation numbers based on data available from Deutsches Statistisches Bundesamt.
- ↑ ५.० ५.१ UK CPI inflation numbers based on data available from Lawrence H. Officer (2010) "What Were the UK Earnings and Prices Then?" MeasuringWorth.
- ↑ Consumer Price Index (estimate) 1800–2008. Federal Reserve Bank of Minneapolis. Retrieved December 7, 2010.