Template:Convert/doc: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Caesar Schinas
(correct SI/Metric)
imported>Caesar Schinas
(add usage)
Line 2: Line 2:
The goal of this template is to make [[Citizendium]] accessable to all readers regardless of nationality. Instead of only showing [[SI units|SI/Metric units]] or [[Imperial units]], {{tl|convert}} automatically converts a number from the specified unit to another unit and displays it as "'''Metric (Imperial)'''" or "'''Imperial (Metric)'''", depending on which unit was converted from.
The goal of this template is to make [[Citizendium]] accessable to all readers regardless of nationality. Instead of only showing [[SI units|SI/Metric units]] or [[Imperial units]], {{tl|convert}} automatically converts a number from the specified unit to another unit and displays it as "'''Metric (Imperial)'''" or "'''Imperial (Metric)'''", depending on which unit was converted from.


== Usage ==
The template has four parameters - {{tlc|convert|number{{!}}from{{!}}to{{!}}precision}}.
# ''required'' — The number to convert.
# ''required'' — The unit to convert ''from''.
# ''required'' — The unit to convert ''to''.
# ''required'' — The precision of the result - either a number of decimal places, or a negative number to specify a number of significant figures.
==Supported Conversions==
<div style="height: 400px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; reflist4" >
<div style="height: 400px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; reflist4" >
==Supported Conversions==
===Millimeters to...===
===Millimeters to...===
====Inches====
====Inches====

Revision as of 00:23, 16 June 2009

This template is used in articles to easily convert one unit to another. This template will always be under construction, as we can’t possibly include conversions ‘’from’’ every possible unit ‘’to’’ every possible unit. However, whenever a conversion isn’t supported, I or any of the other users who have worked on this template would be happy to add conversions when brought to our attention. The goal of this template is to make Citizendium accessable to all readers regardless of nationality. Instead of only showing SI/Metric units or Imperial units, {{convert}} automatically converts a number from the specified unit to another unit and displays it as "Metric (Imperial)" or "Imperial (Metric)", depending on which unit was converted from.

Usage

The template has four parameters - {{convert|number|from|to|precision}}.

  1. required — The number to convert.
  2. required — The unit to convert from.
  3. required — The unit to convert to.
  4. required — The precision of the result - either a number of decimal places, or a negative number to specify a number of significant figures.

Supported Conversions

Millimeters to...

Inches

{{Convert|10|mm|in}} Produces 10 mm (0.39 in).
Supported parameters include mm, millimetre, millimetres, millimeter, millimeters, in, inch, and inches.

Feet

{{Convert|10|mm|ft}} Produces 10 mm (0.03 ft).
Supported parameters include mm, millimetre, millimetres, millimeter, millimeters, ft, foot, and feet.

Centimeters to...

Inches

{{Convert|10|cm|in}} Produces 10 cm (3.94 in).
Supported parameters include cm, centimetre, centimetres, centimeter, centimeters, in, inch, and inches.

Feet

{{Convert|10|cm|ft}} Produces 10 cm (0.33 ft).
Supported parameters include cm, centimetre, centimetres, centimeter, centimeters, ft, foot, and feet.

Decimeters to...

Inches

{{Convert|10|dm|in}} Produces 10 dm (39.37 in).
Supported parameters include dm, decimetre, decimetres, decimeter, decimeters, in, inch, and inches.

Feet

{{Convert|10|dm|ft}} Produces 10 dm (3.28 ft).
Supported parameters include dm, decimetre, decimetres, decimeter, decimeters, ft, foot, and feet.

Meters to...

Inches

{{Convert|10|m|in}} Produces 10 m (393.7 in).
Supported parameters include m, metre, metres, meter, meters, in, inch, and inches.

Feet

{{Convert|10|m|ft}} Produces 10 m (32.81 ft).
Supported parameters include m, metre, metres, meter, meters, ft, foot, and feet.

Yards

{{Convert|10|m|yd}} Produces 10 m (10.94 yd).
Supported parameters include m, metre, metres, meter, meters, yd, yard, and yards.

Miles

{{Convert|10|m|mi}} Produces 10 m (0.01 mi).
Supported parameters include m, metre, metres, meter, meters, mi, mile, miles.

Nautical Miles

{{Convert|10|m|nmi}} Produces 10 m (0.01 nmi).
Supported parameters include m, metre, metres, meter, meters, nmi, nautical mile, nautical miles.

Kilometers to...

Yards

{{Convert|10|km|yd}} Produces 10 km (10936.13 yd).
Supported paramaters include km, kilometre, kilometres, kilometer, kilometers, yd, yard, and yards.

Miles

{{Convert|10|km|mi}} Produces 10 km (6.21 mi).
Supported parameters include km, kilometre, kilometres, kilometer, kilometers, mi, mile, and miles.

Nautical Miles

{{Conver|10|km|nmi}} Produces 10 km (5.4 nmi).
Supported parameters include km, kilometre, kilometres, kilometer, kilometers, nmi, nautical mile, nautical miles.

Inches to...

Millimetres

{{Convert|10|in|mm}} Produces 10 in (254 mm).
Supported parameters include in, inch, inches, mm, millimetre, and millimetres.

Centimetres

{{Convert|10|in|cm}} Produces 10 in (25.4 cm).
Supported parameters include in, inch, inches, cm, centimetre, and centimetres.

Decimetres

{{Convert|10|in|dm}} Produces 10 in (2.54 dm).
Supported parameters include in, inch, inches, dm, decimetre, and decimetres.

Metres

{{Convert|10|in|m}} Produces 10 in (0.25 m).
Supported parameters include in, inch, inches, m, metre, and metres.

Feet to...

Millimetres

{{Convert|10|ft|mm}} Produces 10 ft (3048 mm).
Supported parameters include ft, foot, feet, mm, millimetre, and millimetres.

Centimetres

{{Convert|10|ft|cm}} Produces 10 ft (304.8 cm).
Supported parameters include ft, foot, feet, cm, centimetre, and centimetres.

Decimetres

{{Convert|10|ft|dm}} Produces 10 ft (30.48 dm).
Supported parameters include ft, foot, feet, dm, decimetre, and decimetres.

Metres

{{Convert|10|ft|m}} Produces 10 ft (3.05 m).
Supported parameters include ft, foot, feet, m, metre, and metres.

Kilometres

{{Convert|10|ft|km}} Produces 10 ft (0 km).
Supported parameters include ft, foot, feet, km, kilometre, and kilometres.

Yards to...

Millimetres

{{Convert|10|yd|mm}} Produces 10 yd (9144 mm).
Supported parameters include yd, yard, yards, mm, millimetre, and millimetres.

Centimetres

{{Convert|10|yd|cm}} Produces 10 yd (914.4 cm).
Supported parameters include yd, yard, yards, cm, centimetre, and centimetres.

Decimetres

{{Convert|10|yd|dm}} Produces 10 yd (91.44 dm).
Supported parameters include yd, yard, yards, dm, decimetre, and decimetres.

Metres

{{Convert|10|yd|m}} Produces 10 yd (9.14 m).
Supported parameters include yd, yard, yards, m, metre, and metres.

Kilometres

{{Convert|10|yd|km}} Produces 10 yd (0.01 km).
Supported parameters include yd, yard, yards, km, kilometre, and kilometres.

Miles to...

Metres

{{Convert|10|mi|m}} Produces 10 mi (16093.44 m).
Supported parameters include mi, mile, miles, m, metre, and metres.

Kilometres

{{Convert|10|mi|km}} Produces 10 mi (16.09 km).
Supported parameters include mi, mile, miles, km, kilometre, and kilometres.

Nautical Miles

{{Convert|10|mi|nmi}} Produces 10 mi (8.69 nmi).
Supported parameters include mi, mile, miles, nmi, nautical mile, and nautical miles.

Nautical Miles to...

Metres

{{Convert|10|nmi|m}} Produces 10 nmi (18520 m).
Supported parameters include nmi, nautical mile, nautical miles, m, metre, and metres.

Kilometres

{{Convert|10|nmi|km}} Produces 10 nmi (18.52 km).
Supported parameters include nmi, nautical mile, nautical miles, km, kilometre, and kilometres.

Miles

{{Convert|10|nmi|mi}} Produces 10 nmi (11.51 mi).
Supported parameters include nmi, nautical mile, nautical miles, mi, mile, and miles.

Rounding

{{Convert}} has an additional parameter that controls roundin. More specifically, it controls how many places after the decimal are displayed. To use this feature, add a value in the fourth parameter. For example {{Convert|10|km|mi|5}} shows up to the fifth decimal place, displaying as 10 km (6.21371 mi).

Examples

{{Convert|547.3|km|mi|0}} hides the decimals, displaying as 547.3 km (340 mi).

{{Convert|547.3|km|mi|1}} shows one decimal, displaying as 547.3 km (340.1 mi)

{{Convert|547.3|km|mi|2}} shows two decimals, displaying as 547.3 km (340.08 mi)

{{Convert|547.3|km|mi|3}} shows three decimals, displaying as 547.3 km (340.076 mi)

{{Convert|547.3|km|mi|10}} shows ten decimals, displaying as 547.3 km (340.0764533816 mi)

Parameters That Need to be Created

Add units of measurement, and their conversion formulas, that still need to be created here