Difference between revisions of "Template:Formatnum"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (+French;)
m (*renamed Parameter Table to Parameter table;)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly><span style="white-space:nowrap;">{{Formatnum/Core|{{{1}}}|{{{2|0}}}}}</span></includeonly><noinclude>An language specific to the [[w:mw:Extension:FormatNum|FormatNum extension]]. Following values for the languages are used:
+
<includeonly><span style="white-space:nowrap;">{{#formatnum:{{{1}}}|{{#if: {{{2|}}}|{{{2}}}|0}}|{{DS}}|t}}</span></includeonly><noinclude>An language specific to the [[w:mw:Extension:FormatNum|FormatNum extension]]. Uses a [[w:Thin space|&amp;thinsp;]] (thin space) as thousand separator and a decimal seperator depending on the language (see {{Tl|DS}}). It also places the number in a &lt;span&gt; with the CSS property <tt>white-space</tt> set to <tt>nowrap</tt> to avoid line breaks.
{| class="wikitable mw-datatable"
 
! Language code
 
! Decimal separator
 
! Thousand separater
 
|-
 
| de
 
| ,
 
| rowspan="3" valign="top" | [[w:Thin space|&amp;thinsp;]]
 
|-
 
| en
 
| .
 
|-
 
| fr
 
| ,
 
|}
 
  
 
According to [[w:ISO_31-0#Numbers|ISO 31-0]] (and in German also [[w:de:DIN 1333|DIN 1333]], [[w:de:DIN 5008|5008]]) a space should be used as a thousand separator to avoid confusion with the decimal separator. This templates uses the Unicode 8201<sub>10</sub> (or 2009<sub>16</sub>) which is a thin space.
 
According to [[w:ISO_31-0#Numbers|ISO 31-0]] (and in German also [[w:de:DIN 1333|DIN 1333]], [[w:de:DIN 5008|5008]]) a space should be used as a thousand separator to avoid confusion with the decimal separator. This templates uses the Unicode 8201<sub>10</sub> (or 2009<sub>16</sub>) which is a thin space.
 +
 +
To format a number without the &lt;span&gt;, for example in tool tips, use the following code: <code><nowiki>{{#formatnum:NUMBER|NUMBER OF DECIMAL PLACES|{{DS}}|t}}</nowiki></code>
  
 
== Parameters ==
 
== Parameters ==
{| class="wikitable"
+
{{Parameter table|parameters=
! #
+
{{Parameter row|1|Number to be formatted}}
! Optional
+
{{Parameter row|2|Number of decimal places.|0}}
! Description
+
}}
{{ParameterRow|1|Number to be formatted}}
+
 
{{ParameterRow|2|Number of decimal places|0}}
+
== See also ==
|}
+
* {{Tl|Formatnum/SortCell}} automatically adds the <tt>data-sort-value</tt> and then calls this template
  
[[Category:Templates|Formatnum]]</noinclude>
+
[[Category:Templates]]</noinclude>

Latest revision as of 12:03, 19 December 2014

An language specific to the FormatNum extension. Uses a &thinsp; (thin space) as thousand separator and a decimal seperator depending on the language (see {{DS}}). It also places the number in a <span> with the CSS property white-space set to nowrap to avoid line breaks.

According to ISO 31-0 (and in German also DIN 1333, 5008) a space should be used as a thousand separator to avoid confusion with the decimal separator. This templates uses the Unicode 820110 (or 200916) which is a thin space.

To format a number without the <span>, for example in tool tips, use the following code: {{#formatnum:NUMBER|NUMBER OF DECIMAL PLACES|{{DS}}|t}}

Parameters

# Optional Description Default
1 No Number to be formatted
2 Yes Number of decimal places. 0

See also

  • {{Formatnum/SortCell}} automatically adds the data-sort-value and then calls this template