Template:Inflation and Template:Inflation/sandbox: Difference between pages

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
m (1 revision)
 
m (1 revision)
 
Line 1: Line 1:
{{
<noinclude><!--
-==================================================================
-  Template:Inflation - For a nation code inflate amount from year
-==================================================================
--                              (see NOTES at bottom)
--></noinclude>{{
#iferror: {{#expr:{{formatnum:{{{1|UK}}}|R}} }}
  |<!--then has alpha code ok, else-->
  |<br><span class="error">{Inflation} - Parameter 1 has number<!--
    --> "</span>{{{1|70}}}<span class=error>" - expected a country<!--
    --> code such as: AU, CA, DE, UK, US (etc.) with parameter 2<!--
    --> amount:</span>&nbsp;{{{2|8}}}.&nbsp;&nbsp;
}}{{
#switch: {{padleft:|1|{{{2|8}}}x|}}
#switch: {{padleft:|1|{{{2|8}}}x|}}
   |0|1|2|3|4|5|6|7|8|9 =
   |0|1|2|3|4|5|6|7|8|9 =
Line 40: Line 52:
}}{{#ifeq:{{{fmt|raw}}}|eq
}}{{#ifeq:{{{fmt|raw}}}|eq
   |&#32;in {{{4|{{CURRENTYEAR}}|}}}
   |&#32;in {{{4|{{CURRENTYEAR}}|}}}
}}<noinclude>
}}<noinclude><!--
-------------------------------------------------------------------
--NOTES
--
-- NOTE A1: This template calculates the inflated value of a given
--      currency amount based on nation code and a range of years.
--
-- NOTE F2: The optional format parameters, fmt=c and fmt=eq, can be
--      used to simply display commas or a typical "equivalent to"
--      phrase which can help provide clarity of calculated amounts.
--      For option "fmt=eq":  "equivalent to $1,000 in 2013".
--      In text, the year can be specified just once to both compute
--      the inflated value and show the year in the phrase.  Many
--      pages have formatted the result with Template:Formatprice.
--     
-- NOTE V3: The parameters are validated to show error messages, for
--      invalid amounts or years outside the range of supported years.
--      Previously, invalid year caused "NaN" ("not a number") which
--      could confuse users to wonder why using an actual number in
--      the amount or year range would be called "NaN".
--
----------------------------------------------------------------------
-HISTORY:
-25May2008 Created to calculate inflated value of currency.
-27May2008 Split to use subtemplates {Inflation/{{{1|US}}}/startyear}
-12Jan2013 Validated parameters to show specific error messages.
-12Jan2013 New "fmt=c" to show commas in output amount.
-12Jan2013 New "fmt=eq" "equivalent to {cursign}~ in {4|CURRENTYEAR}"
-12Jan2013 New "cursign=x" for currency sign (default: $).
-12Jan2013 Put NOTES comments to explain template operation.
-12Jan2013 Put HISTORY comments to log major changes (not typos).
-14Jan2012 Validated {1} when numeric as needing a nation code.
-
-->
{{Documentation}}</noinclude>
{{Documentation}}</noinclude>