Jump to content

Шаблон:Convert/getunit

Мавод аз Википедиа — донишномаи озод

feet

Ҳуҷҷатгузорӣ

Usage

The Template:Convert/getunit displays the unit name, or unit symbol, for the unit-code specified in parameter 2 of a conversion. For example, to show the unit name for unit-code "ft" use:

  • {{convert/getunit |2.5|ft}}         → feet
  • {{convert/getunit |2.5|ft|lk=in}} → feet
  • {{convert/getunit |2.5|ft|abbr=on}} → ft
  • {{convert/getunit |2.5|ft|lk=in|adj=on}} → foot
  • {{convert/getunit |6|m|sp=us}} → meters

If a named unit-code 'xyz' is not defined, then the result will display a red-linked template name to indicate the unit-code named xyz is not defined. Option "abbr=values" will omit the unit.

  • {{convert/getunit |2.5|ft|abbr=values}} →

This template does not need subtemplates for every possible one of 450 combinations of lk/abbr/adj with the suffixes "Na" for non-abbreviated units or "Imp" for imperial units or "eng" for engineering units, etc. Unlike "disp=unit" there will be no occasional redlinks each month for the rare options such as "Convert/LonAoffDunitSonNa" etc.

Other examples:

  • {{convert/getunit |1|m}}    → metre
  • {{convert/getunit |1/2|ft}} → foot
  • {{convert/getunit |3+7/8|ft}} → feet
  • {{convert/getunit |3/8|in}} → inch

See also