الگو:Inflation/تمرین
اینجا صفحهٔ تمرین الگو برای الگو:Inflation (تفاوت) است. همچنین زیرصفحه همنشین برای نمونههای آزمایشی را ببینید. |
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. |
Do not assume that using this template will mean that a calculated value is "current", "as of ۲۰۲۴", "as of خطای عبارت: نویسه نقطهگذاری شناخته نشده «۲»" or even necessarily "recent". Per ویکیپدیا:شیوهنامه/واژههایی که باید از آنها دوری گزید، statements made using this template should either specify an end_year , or rely on |fmt=eq or {{Inflation-year}} to automatically indicate the latest year this template provides an inflation calculation. Do not use {{CURRENTISOYEAR}} . |
این الگو از ویژگی و دستورهای پیچیده استفاده میکند.
توصیه میشود پیش از ویرایش الگو با دستورهای الگو و توابع تجزیهکننده آشنا شوید. اگر ویرایشتان باعث بروز مشکلات غیرمنتظره شد، خواهشمند است آن را بهسرعت برگردانید، زیرا ممکن است این الگو در شمار زیادی صفحه ظاهر شود. بهیاد داشته باشید که شما میتوانید آزمایش انجام دهید، اما باید همهٔ بهسازیها را پیش از آنکه در اینجا اعمال کنید، در صفحهٔ تمرین عمومی الگو یا فضای کاربریتان بیازمایید. |
دقت کنید که پروندههای دادهای مورد نیاز برای کشور مورد نظر همانند آنچه در اینجا میبینید به صورت زیرصفحههای این الگو بر حسب کد کشور (پارامتر اول الگو) وجود داشته باشند.
This template takes a country_code, for example, "US" for the ایالات متحده آمریکا or "UK" for بریتانیا، a value in that country's currency, a start_year, and applies to it the country's شاخص قیمت مصرفکننده 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 |
---|---|---|
استرالیا[۲] | AU | ۱۹۰۱ |
کانادا[۳] | CA | ۱۹۱۶ |
آلمان[۴] | DE | ۱۸۸۲ |
بریتانیا[۵] | UK | ۱۲۶۴ |
ایالات متحده آمریکا[۶] | US | ۱۸۰۰ |
- 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}}
= ۱٬۱۷۰٬۶۷۷ -
{{Inflation|US|1000000|2001|2001}}
= ۱٬۰۰۰٬۰۰۰ -
{{Inflation|US|1000000|1990|2005|r=2}}
= ۱٬۴۹۴٬۹۰۵٫۷۶ -
{{Inflation|UK|1000000|1323|1978|r=-3}}
= ۱۱۴٬۶۱۰٬۰۰۰
Entering invalid parameters will result in a link to the NaN article:
-
{{Inflation}}
= خطا هنگام استفاده از {{تورم}}: وارد کردن|شاخص=
(پارامتر ۱)،|مقدار=
(پارامتر ۲) و|سال آغاز=
(پارامتر ۳) الزامی است. -
{{Inflation|abc}}
= خطا هنگام استفاده از {{تورم}}: وارد کردن|مقدار=
(پارامتر ۲) و|سال آغاز=
(پارامتر ۳) الزامی است. -
{{Inflation|DE|1000000}}
= خطا هنگام استفاده از {{تورم}}: وارد کردن|سال آغاز=
(پارامتر ۳) الزامی است. -
{{Inflation|US|1000000|1200|3000}}
= خطا هنگام استفاده از {{تورم}}: خطای عبارت: نویسه نقطهگذاری شناخته نشده «۱» و|سال پایان=3000
(پارامتر ۴) بزرگتر از بالاترین سال در دسترس (۲۰۲۲) برای شاخص «US» است. -
{{Inflation|UK|1000000|2005|2004}}
= خطا هنگام استفاده از {{تورم}}: خطای عبارت: نویسه نقطهگذاری شناخته نشده «۱» و|سال آغاز=2005
(پارامتر ۳) بزرگتر از|سال پایان=2004
(پارامتر ۴).
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 (۴٬۰۶۲٫۹۳) 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 ۲٬۰۰۶٬۱۰۲.00 - £{{formatnum:
{{Inflation|UK|1000000|1323|1978|r=-4}}
}} = £۱۱۴٬۶۱۰٬۰۰۰ - ${{formatnum:
{{Inflation|US|1000000|1990|r=2}}
}} = $۲٬۲۳۹٬۹۳۸٫۸۷
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:
- ${{formatnum:
{{Inflation|US|1000000000|1900|r=-8}}
}} = $۳۵٬۲۰۰٬۰۰۰٬۰۰۰ - ${{formatnum:
{{Inflation|US|1000000|1900|r=-5}}
}} thousand = $۳۵٬۲۰۰٬۰۰۰ thousand - ${{formatnum:
{{Inflation|US|1000|1900|r=-2}}
}} million = $۳۵٬۲۰۰ million - ${{formatnum:
{{Inflation|US|1|1900|r=1}}
}} billion = $۳۵٫۲ 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 "۹۵۴ میلیارد", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "۱٬۲۳۵".
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 ۲٫۰۱ میلیون - £{{Formatprice|
{{Inflation|UK|1000000|1323|1978|r=-4}}
}} = £۱۱۵ میلیون - ${{Formatprice|
{{Inflation|US|1000000|1990|r=2}}
}} = $۲٫۲۴ میلیون - ${{Formatprice|
{{Inflation|US|1000000000|1900|r=-8}}
}} = $۳۵٫۲ میلیارد
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):
- In 1910 a blah cost on average £1,000. This is equivalent to £۱۰۸٬۶۰۲ in present day terms.[۵]
The footnote thus generated appears whenever {{reflist}}
or {{پانویس}} 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
جستارهای وابسته
[ویرایش]- {{Inflation-fn}}
- {{Formatprice}}
- تورم
- شاخص قیمت مصرفکننده
- Harmonised Index of Consumer Prices
- List of country codes
- List of circulating currencies
- United States Consumer Price Index
- Consumer Price Index (United Kingdom)
منابع
[ویرایش]- ↑ 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 (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
- ↑ 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. Retrieved March 6, 2019. and 18-10-0004-13 "Consumer Price Index by product group, monthly, percentage change, not seasonally adjusted, Canada, provinces, Whitehorse, Yellowknife and Iqaluit". Statistics Canada. Retrieved March 6, 2019.
- ↑ German inflation numbers based on data available from Deutsches Statistisches Bundesamt.
- ↑ ۵٫۰ ۵٫۱ 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. Retrieved January 27, 2019.
- ↑ Federal Reserve Bank of Minneapolis Community Development Project. "Consumer Price Index (estimate) 1800–". Federal Reserve Bank of Minneapolis. Retrieved January 2, 2019.