Template:Convert/doc

From PS:1 Wiki Dev
Jump to navigationJump to search

Usage

This template converts values between different units of measurement. It uses Module:Convert to provide comma-formatted numbers and accurate conversions.

Format

{{Convert|value|unit|precision}}
  • value = the number to convert
  • unit = the unit abbreviation (see below)
  • precision = optional decimal places (defaults vary by unit)

Examples

Length

{{Convert|12|in}}

Output: 12 in (30.5 cm)

{{Convert|6|ft}}

Output: 6 ft (1.83 m)

{{Convert|100|cm}}

Output: 100 cm (39.4 in)

{{Convert|5000|ft}}

Output: 5,000 ft (1,524.00 m)

Weight/Mass

{{Convert|50|lb}}

Output: 50 lb (22.68 kg)

{{Convert|16|oz}}

Output: 16 oz (453.6 g)

{{Convert|2500|lb}}

Output: 2,500 lb (1,133.98 kg)

Volume

{{Convert|5|gal}}

Output: 5 gal (18.93 L)

Temperature

{{Convert|72|F}}

Output: 72 °F (22.2 °C)

{{Convert|100|C}}

Output: 100 °C (212.0 °F)

Area

{{Convert|1000|sqft}}

Output: 1000 sq ft (92.90 m²)

Power

{{Convert|5|hp}}

Output: 5 hp (3.73 kW)

{{Convert|1500|W}}

Output: 1500 W (1.50 kW)

Speed

{{Convert|60|mph}}

Output: 60 mph (96.56 km/h)

Pressure

{{Convert|30|psi}}

Output: 30 psi (206.84 kPa)

Custom precision

{{Convert|12.5|in|0}}

Output: 12.5 in (32 cm)

{{Convert|100|lb|3}}

Output: 100 lb (45.359 kg)

Supported units

Length

  • in - inches → centimeters
  • cm - centimeters → inches
  • ft - feet → meters
  • m - meters → feet
  • mi - miles → kilometers
  • km - kilometers → miles

Weight/Mass

  • lb - pounds → kilograms
  • kg - kilograms → pounds
  • oz - ounces → grams
  • g - grams → ounces

Volume

  • gal - gallons → liters
  • L - liters → gallons

Temperature

  • F - Fahrenheit → Celsius
  • C - Celsius → Fahrenheit

Area

  • sqft - square feet → square meters
  • sqm - square meters → square feet

Power

  • hp - horsepower → kilowatts
  • kW - kilowatts → horsepower
  • W - watts → kilowatts

Speed

  • mph - miles per hour → km/h
  • kmh - km/h → miles per hour

Pressure

  • psi - pounds per square inch → kilopascals
  • kPa - kilopascals → psi

Default precision

  • Length: 1 decimal place (in, cm, oz, g)
  • Other units: 2 decimal places
  • Override with third parameter: {{Convert|value|unit|precision}}

Notes

  • This template uses Module:Convert (requires Lua/Scribunto)
  • Numbers are automatically formatted with commas (e.g., 1,000 instead of 1000)
  • Conversions are one-way: the unit determines the target unit
  • Unsupported units will display "(conversion not supported)"
  • The module rounds to appropriate precision for each unit type

Common hackerspace uses

  • Tool specifications: {{Convert|10|in}}
  • Material dimensions: {{Convert|4|ft}}
  • Weight limits: {{Convert|500|lb}}
  • Power ratings: {{Convert|3|hp}}
  • Operating temperatures: {{Convert|350|F}}

See also