Jump to content

Module:Convert/doc

From Simple English Wikipedia, the free encyclopedia
Revision as of 20:36, 3 January 2014 by Osiris (talk | changes) (from https://en.wikipedia.org/w/index.php?title=Module:Convert/doc&oldid=585543841)

This is the documentation page for Module:Convert

This module converts a value from one unit of measurement to another. For example:

  • {{convert|123|lb|kg}} → 123 pounds (56 kg)

The module is called using a template—parameters passed to the template are used by this module to control how a conversion is performed. For example, units can be abbreviated (like kg), or displayed as names (like kilogram), and the output value can be rounded to a specified precision. For usage information, see the template's documentation.

The template that invokes this module is:

The following modules are required:

The following modules are optional and are used only if required and if the module exists:

The following help pages are available:

A page containing a convert error is added to one of the following categories, providing the page is in a specified namespace (articles and templates, by default):

Module:Convert/data is transcluded into every page using the convert module, so experimenting with a new unit in that module would involve a significant overhead. The Module:Convert/extra module is an alternative which is only transcluded on pages with a unit that is not defined in the main data module.

Configuration

The template that invokes this module can define options to configure the module. For example:

  • {{#invoke:convert | convert | numdot = , | numsep = . }}
Sets the decimal mark to be a comma, and the thousands separator to be a dot.

Other options, with default values, are:

  • maxsigfig = 14 – maximum number of significant figures
  • nscat = 0,10namespaces in which an error or warning adds a category to the page
  • warnings = 0 – 0 (zero) disables warnings; 1 shows important warnings; 2 shows all warnings
  • sandbox = off – on if the sandbox modules should be used

Other configuration is available in the translation_table at Module:Convert/text. For example, bn:Module:Convert/text uses:

  • group = 2 – group numbers 3 digits, then 2 digits
  • plural_suffix = '' – disable plural unit names (do not append "s")
  • Tables to translate digits to and from the English digits used in calculations.

Module:Convert/text contains all text used for input parameters and for output messages and categories. For example, lk=on may be used at en.wikipedia to link each displayed unit to its article. The text module could be edited to replace "lk" and "on" with any desired text.