编辑“︁
Template:Inflation/doc
”︁(章节)
跳转到导航
跳转到搜索
这是
Inflation
模板的
文档页面
。
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
=== 用法 === {{Tlx|Inflation|國家代碼|''value''|''start_year''}} {{Tlx|Inflation|國家代碼|''value''|''start_year''|''end_year''}} {{Tlx|Inflation|國家代碼|''value''|''start_year''|5=r=''decimals''|6=fmt=c}} {{Tlx|Inflation|國家代碼|''value''|''start_year''|5=r=''decimals''|6=fmt=eq}} {{Tlx|Inflation|國家代碼|''value''|''start_year''|5=r=''decimals''|6=fmt=eq|7=cursign=X}} 此模板支援以下的貨幣: {| class="wikitable sortable" ! scope="col" | <code>國家代碼</code> !! scope="col" | 國家 !! scope="col" | 最早支援年份<code>start_year</code>!! scope="col" | 最晚支援年份<code>end_year</code> |- ! scope="row" | AU | style="text-align:left;" | [[澳洲]]{{Inflation/fn|AU}} || {{Inflation/AU/startyear}} || {{Inflation/year|AU}} |- ! scope="row" | AU-road | style="text-align:left;" | [[澳洲]][...?]{{Inflation/fn|AU-road}} || {{Inflation/AU-road/startyear}} || {{Inflation/year|AU-road}} |- ! scope="row" | CA | style="text-align:left;" | [[加拿大]]{{Inflation/fn|CA}} || {{Inflation/CA/startyear}} || {{Inflation/year|CA}} |- ! scope="row" | DE | style="text-align:left;" | [[德國]]{{Inflation/fn|DE}} || {{Inflation/DE/startyear}} || {{Inflation/year|DE}} |- ! scope="row" | JP | style="text-align:left;" | [[日本]]{{Inflation/fn|JP}} || {{Inflation/JP/startyear}} || {{Inflation/year|JP}} |- ! scope="row" | UK | style="text-align:left;" | [[英國]]{{Inflation/fn|UK}} || {{Inflation/UK/startyear}} || {{Inflation/year|UK}} |- ! scope="row" | US | style="text-align:left;" | [[美國]]{{Inflation/fn|US}} || {{Inflation/US/startyear}} || {{Inflation/year|US}} |- ! scope="row" | US-GDP | style="text-align:left;" | [[美國]][[平均物价指数]]{{Inflation/fn|US-GDP}} || {{Inflation/US-GDP/startyear}} || {{Inflation/year|US-GDP}} |- |} * '''end_year''':如有輸入,數值必須比<tt>start_year</tt>大,比現時年份小。沒有輸入則預設為今年。 * '''r'''=''digit'':設定四捨五入至某個數值,預設為0。 例子: * {{aye}} {{tlx|Inflation|DE|1000000|2000}} = {{Inflation|DE|1000000|2000}} * {{aye}} {{tlx|Inflation|US|1000000|2001|2001|fmt=eq}} = {{Inflation|US|1000000|2001|2001|fmt=eq}} * {{aye}} {{tlx|Inflation|US|1000000|1990|2005|r{{=}}2}} = {{Inflation|US|1000000|1990|2005|r=2}} * {{aye}} {{tlx|Inflation|UK|1000000|1323|1978|r{{=}}-3}} = {{Inflation|UK|1000000|1323|1978|r=-3}} * {{Aye}} <code>{{mxt|{{tlf|Inflation|JP|100|2000}}}}</code> → {{xt|{{Inflation|JP|100|2000}}}} * {{Aye}} <code>{{mxt|{{tlf|Inflation|DE|100|2000}}}}</code> → {{xt|{{Inflation|DE|100|2000}}}} * {{Aye}} <code>{{mxt|{{tlf|Inflation|US|595|1982}}}}</code> → {{xt|{{Inflation|US|595|1982}}}} * {{Aye}} <code>{{mxt|{{tlf|Inflation|US|595|1982|5=fmt=eq}}}}</code> → {{xt|{{Inflation|US|595|1982|fmt=eq}}}} * {{Aye}} <code>{{mxt|{{tlf|Inflation|US|800|1942|5=fmt=eq|6=r=-3}}}}</code> → {{xt|{{Inflation|US|800|1942|fmt=eq|r=-3}}}} * {{Aye}} <code>{{mxt|{{tlf|Inflation|US|100|2010|2012|6=fmt=eq|7=r=2}}}}</code> → {{xt|{{Inflation|US|100|2010|2012|fmt=eq|r=2}}}} * {{Aye}} <code>{{mxt|<nowiki>US$595</nowiki>({{tlf|Inflation|US|595|1982|5=fmt=eq}})}}</code> → {{xt|US$595({{Inflation|US|595|1982|fmt=eq}})}} * {{Aye}} <code>{{mxt|<nowiki>US$595</nowiki>({{tlf|Inflation|US|595|1982|5=fmt=eq|6=cursign=<nowiki>[[美元|US$]]</nowiki>}})}}</code> → {{xt|US$595({{Inflation|US|595|1982|fmt=eq|cursign=[[美元|US$]]}})}} * {{Aye}} <code>{{mxt|<nowiki>$2,100萬</nowiki>(相当于{{tlf|Inflation/year|US}}的${{tlf|Inflation|US|2100|2005|5=r=0}}萬)}}</code> → {{xt|$2,100萬(相当于{{Inflation/year|US}}年的${{Inflation|US|2100|2005|r=0}}萬)}} * {{Aye}} <code>{{mxt|{{tlf|Inflation|UK|1|1209|5=fmt=eq|6=cursign=£}}}}</code> → {{xt|{{Inflation|UK|1|1209|fmt=eq|cursign=£}}}} * {{Aye}} <code>{{mxt|{{tlf|Inflation|AU|100|{{CURRENTYEAR}}|5=fmt=eq}}}}</code> → {{xt|{{Inflation|AU|100|{{CURRENTYEAR}}|fmt=eq}}}} * {{Aye}} <code>{{mxt|{{tlf|Inflation/year|US}}}}年的{{mxt|${{tlf|Inflation|US|100|{{CURRENTYEAR}}}}}}</code> → {{xt|{{Inflation/year|US}}年的${{Inflation|US|100|{{CURRENTYEAR}}}} }} * {{Aye}} <code>{{mxt|{{tlf|Inflation|UK|100|1982|5=fmt=eq|6=orig=yes|7=cursign=£}}}}</code> → {{xt|{{Inflation|UK|100|1982|fmt=eq|orig=yes|cursign=£}}}} 參數不當會顯示[[NaN]]: * {{nay}} {{tlx|Inflation}} = {{Inflation}} * {{nay}} {{tlx|Inflation|abc}} = {{Inflation|abc}} * {{nay}} {{tlx|Inflation|DE|1000000}} = {{Inflation|DE|1000000}} * {{nay}} {{tlx|Inflation|US|1000000|1200|3000}} = {{Inflation|US|1000000|1200|3000}} * {{nay}} {{tlx|Inflation|UK|1000000|2005|2004}} = {{Inflation|UK|1000000|2005|2004}} ==== 提示與技巧 ==== ===== 貨幣轉換 ===== 此模板不能轉換貨幣單位,因此,如果想知道1960時的1000德國馬克於現在的價值,輸入{{tlx|Inflation|DE|1000|1960|r{{=}}2}}顯示的數值仍爲德國馬克,而非歐元。 所以,如要轉換貨幣單位,需要手動輸入數式,下面例子定義€ 1 = DM 1.95583: * {{aye}} <tt><nowiki>{{#expr:</nowiki>({{tlx|Inflation|DE|1000|1960|r{{=}}2}}<nowiki> / 1.95583) round 2}}</nowiki></tt> ===== 四捨五入 ===== {{para|r}}參數可以定義要四捨五入的數位,輸入{{para|r|2}}會約至2個小數點;輸入{{para|r|-3}}會約至千位;輸入{{para|r|-6}}會約至百萬位,如此類推。 ===== Formatnum ===== 為達到更佳效果,編者可以使用<tt><nowiki>{{</nowiki>[[Help:魔術字|formatnum:]]<nowiki>}}</nowiki></tt>,用{{tlx|Formatprice}}也可。這個功能為數值每三個數位加上一個分隔逗號,但編者不能控制顯示多少小數位。 * {{aye}} <tt>'''DM''' <nowiki>{{formatnum:</nowiki>{{tlx|Inflation|DE|1000000|1957|1978}}<nowiki>}}</nowiki>'''.00'''</tt> = DM {{formatnum:{{Inflation|DE|1000000|1957|1978}}}}.00 * {{aye}} <tt>'''£'''<nowiki>{{formatnum:</nowiki>{{tlx|Inflation|UK|1000000|1323|1978|r{{=}}-4}}<nowiki>}}</nowiki></tt> = £{{formatnum:{{Inflation|UK|1000000|1323|1978|r=-4}}}} * {{aye}} <tt>'''$'''<nowiki>{{formatnum:</nowiki>{{tlx|Inflation|US|1000000|1990|r{{=}}2}}<nowiki>}}</nowiki></tt> = ${{formatnum:{{Inflation|US|1000000|1990|r=2}}}} {{TransH}} 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 <tt><nowiki>{{</nowiki>[[Help:Magic words#Formatting|formatnum:]]<nowiki>}}</nowiki>'ing</tt> 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: * {{nay}} <tt>'''$'''<nowiki>{{formatnum:</nowiki>{{tlx|Inflation|US|1000000000|1900|r{{=}}-8}}<nowiki>}}</nowiki></tt> = ${{formatnum:{{Inflation|US|1000000000|1900|r=-8}}}} * {{nay}} <tt>'''$'''<nowiki>{{formatnum:</nowiki>{{tlx|Inflation|US|1000000|1900|r{{=}}-5}}<nowiki>}}</nowiki> ''thousand''</tt> = ${{formatnum:{{Inflation|US|1000000|1900|r=-5}}}} thousand * {{aye}} <tt>'''$'''<nowiki>{{formatnum:</nowiki>{{tlx|Inflation|US|1000|1900|r{{=}}-2}}<nowiki>}}</nowiki> ''million''</tt> = ${{formatnum:{{Inflation|US|1000|1900|r=-2}}}} million * {{aye}} <tt>'''$'''<nowiki>{{formatnum:</nowiki>{{tlx|Inflation|US|1|1900|r{{=}}1}}<nowiki>}}</nowiki> ''billion''</tt> = ${{formatnum:{{Inflation|US|1|1900|r=1}}}} billion The following section provides an automated way of avoiding this trial and error scenario. ===== Formatprice ===== {{tlx|Formatprice}} is a template specifically designed to display price values, both big and small, in a more pleasant way than <tt><nowiki>{{</nowiki>[[Help:Magic words#Formatting|formatnum:]]<nowiki>}}</nowiki></tt> 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 "{{Formatprice|953783409856.12}}", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "{{Formatprice|1234.5}}". On the down side, {{tlx|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. * {{aye}} <tt>'''DM''' <nowiki>{{</nowiki>[[Template:Formatprice|Formatprice]]<nowiki>|</nowiki>{{tlx|Inflation|DE|1000000|1957|1978}}<nowiki>}}</nowiki></tt> = DM {{Formatprice|{{Inflation|DE|1000000|1957|1978}}}} * {{aye}} <tt>'''£'''<nowiki>{{</nowiki>[[Template:Formatprice|Formatprice]]<nowiki>|</nowiki>{{tlx|Inflation|UK|1000000|1323|1978|r{{=}}-4}}<nowiki>}}</nowiki></tt> = £{{Formatprice|{{Inflation|UK|1000000|1323|1978|r=-4}}}} * {{aye}} <tt>'''$'''<nowiki>{{</nowiki>[[Template:Formatprice|Formatprice]]<nowiki>|</nowiki>{{tlx|Inflation|US|1000000|1990|r{{=}}2}}<nowiki>}}</nowiki></tt> = ${{Formatprice|{{Inflation|US|1000000|1990|r=2}}}} * {{aye}} <tt>'''$'''<nowiki>{{</nowiki>[[Template:Formatprice|Formatprice]]<nowiki>|</nowiki>{{tlx|Inflation|US|1000000000|1900|r{{=}}-8}}<nowiki>}}</nowiki></tt> = ${{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 {{tl|Inflation/fn|country}} 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: * <tt><nowiki>In 1910 a ''blah'' cost on average £1,000. This is equivalent to £{{Formatprice|{{Inflation|</nowiki>'''UK'''<nowiki>|1000|1910|r=2}}}} in present day </nowiki>{{Nowrap|terms.<nowiki>{{Inflation/fn|</nowiki>'''UK'''<nowiki>}}</nowiki>}}</tt> 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 £{{Formatprice|{{Inflation|UK|1000|1910|r=2}}}} in present day terms.{{Inflation/fn|UK}} The footnote thus generated appears whenever {{tlx|reflist}} or <tt><nowiki><references /></nowiki></tt> is used in an article, usually in its "References" section. See below for the live example in this document's own [[Template:Inflation#References|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 [[Template talk:Inflation|talk page]]. Adding it won't be difficult, but there's no point in doing so before someone actually needs it. #[[Wikipedia:Template substitution|Substitution]] isn't supported at all. Trying to <tt><nowiki>{{subst:</nowiki>[[Template:Inflation|Inflation]]<nowiki>|...}}</nowiki></tt> 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 [[Special:ExpandTemplates|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 {{TransF}}
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
模板
讨论
大陆简体
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息