Template:Length conversion

From Wikipedia, the free encyclopedia

 Do not use this template in articles. Please use the templates at Category:Dist templates instead
See the talk page for why. This template here is kept for reference purposes.

Template:Length conversion should not be used, see [1] for why Unknown unit: "{{{from}}}"!

Contents

[edit] Documentation

This template displays a length value and its conversion to another length unit using parser functions.

[edit] Usage

The template takes three parameters from, to and value.

Example: {{length conversion | from=furlongs | to=m | value=3}} shows

Template:Length conversion should not be used, see [2] for why 3 furlongs (604 m)


The optional decimals parameter controls the maximum number of displayed digits after the decimal. The default accuracy is zero which rounds to the nearest whole number. For example, decimals=2 rounds the raw value 1.23456 to 1.23. Negative values round to the left of the decimal. For example, decimals=-3 rounds the raw value of 3141592 to 3142000.

Example: {{length conversion | from=furlongs | to=m | value=3 | decimals=3}} shows

Template:Length conversion should not be used, see [3] for why 3 furlongs (603.504 m)


Optionally, unnamed parameters for from, to and value may be used.

Example: {{length conversion | metres | inch | 299792458 | decimals=3}} produces

Template:Length conversion should not be used, see [4] for why 299792458 m (11802852677.166 in)


Typing saver alias {{dist}}.

Example: {{dist| from=fathom | to=nautical mile | value=125000 | decimals=3}} .

[edit] Supported units

These are valid units to convert between. Additions are appreciated:

  • metre, metres, meter, meters, m
  • kilometre, kilometres, kilometer, kilometers, km
  • inch, inches, in
  • foot, feet, ft
  • yard, yards, yd
  • mile, miles, mi
  • chain, chains
  • fathom, fathoms
  • furlong, furlongs
  • nautical mile, nautical miles, nmi, sea mile, sea miles

[edit] Errors

Error messages are intended to be self explanatory. Examples

{{length conversion | metres | square meters | 299792458 | decimals=3}} produces

Template:Length conversion should not be used, see [5] for why Unable to convert from metres to " square meters "!

{{length conversion | from=metres | too=square meters | value=299792458 | decimals=3}} produces

Template:Length conversion should not be used, see [6] for why Unable to convert from metres to "{{{to}}}"!

{{length conversion | src=metres | dst=square meters | value=299792458}} produces

Template:Length conversion should not be used, see [7] for why Unknown unit: "{{{from}}}"!