Template:Length conversion

From Wikipedia, the free encyclopedia

This template may not be the best choice for articles. Please use the templates at Category:Dist templates instead if they meet your needs
See the talk page for why.
[edit] Template documentation

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 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 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 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 Unable to convert from metres to " square meters "!

{{length conversion | from=metres | too=square meters | value=299792458 | decimals=3}} produces Unable to convert from metres to "{{{to}}}"!

{{length conversion | src=metres | dst=square meters | value=299792458}} produces Unknown unit: "{{{from}}}"!