Амодуль:Convert/doc
Это страница документации Амодуль:Convert.
This module depends on the following other modules: |
Этот модуль использует Стили шаблонов: |
Ахәҭаҷ/асекциа адырра апроцесс аԥсуа бызшәа аиҭагара ахь. Абызшәа адырра шәазҟазазар, ишәылшоит шәхы алашәырхәыр. |
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 Help:Convert.
Ашаблонқәеи амодульқәеи
аредакциазураTemplates that invoke this module are:
- Ашаблон:Convert
- Ашаблон:Cvt (convert with abbr=on)
The following modules are required:
- Амодуль:Convert – (this module) code to convert units
- Амодуль:Convert/data – unit definitions
- Амодуль:Convert/text – text messages, and parameter names and values
The following modules are optional and are used only if required and if the module exists:
- Амодуль:Convert/extra – extra (temporary) unit definitions; used if a unit is not found in Module:Convert/data
- Амодуль:ConvertNumeric – code to spell an input value in words (only English is supported; however, see vi:Module:ConvertNumeric)
For Wikidata support the following modules are required:
The following help pages are available:
- Help:Convert – overview
- Help:Convert messages – describes error and warning messages; messages link to this page so it is required when the module is copied to another wiki
- Help:Convert units – overview of units
A page containing a convert error is added to the following hidden category, providing the page is in a specified namespace (articles, by default):
Units are defined in the wikitext of the master list of units.
- Амодуль:Convert/documentation/conversion data – master list of unit definitions
- Амодуль:Convert/makeunits – translates wikitext from the master list to Lua
- Module talk:Convert/makeunits – makeunits results; copy the text to Module:Convert/data
Амодуль: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.
Module talk:Convert/show lists all unit links so they can be checked.
Sandbox
аредакциазураWhen making a change, copy the current modules to the sandbox pages, then edit the sandbox copies:
- Module:Convert • Module:Convert/sandbox • same content
- Module:Convert/data • Module:Convert/data/sandbox • does not exist
- Module:Convert/text • Module:Convert/text/sandbox • does not exist
- Module:Convert/extra • Module:Convert/extra/sandbox • does not exist
- Module:Convert/wikidata • Module:Convert/wikidata/sandbox • does not exist
- Module:Convert/wikidata/data • Module:Convert/wikidata/data/sandbox • does not exist
Use the following template to test the results (example {{convert/sandbox|123|lb|kg}}
):
Ашаблон:Convert/sandbox invokes АМодуль:Convert/sandbox with parameter |sandbox=sandbox
which causes convert to use the sandbox modules rather than the normal modules.
The following should be used to test the results of editing the convert modules.
- Ашаблон:Convert/testcases#Sandbox testcases – links to testcases
- Амодуль:Convert/tester – module to run tests by comparing template output with fixed text
It is not necessary to save a testcases page before viewing test results. For example, Template:Convert/testcases/sandbox4 could be edited to change the tests. While still editing that page, paste "Template talk:Convert/testcases/sandbox4
" (without quotes) into the page title box under "Preview page with this template", then click "Show preview".
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
– namespaces (comma separated) 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
An option in the template can specify that the sandbox versions of the modules be used. If specified, the text on the right-hand side of the equals sign must be the name of the subpage for each sandbox module.
|sandbox=sandbox
– omit for normal operation
All text used for input parameters and for output messages and categories can be customized. For example, at enwiki the option |lk=on
can be used to link each displayed unit to its article. The "lk
" and "on
" can be replaced with any desired text. In addition, input and output numbers can be formatted and can use digits in the local language. See the translation guide for more information.
To do
аредакциазураDocument the modules to access Wikidata!
Module version history
аредакциазура- Version 1 December 2013
- Version 2 January 2014
- Version 3 April 2014
- Version 4 July 2014
- Version 5 September 2014
- Version 6 November 2014
- Version 7 December 2014
- Version 8 February 2015
- Version 9 February 2015
- Version 10 May 2015
- Version 11 June 2015
- Version 12 August 2015
- Version 13 March 2016
- Version 14 June 2016 (introduced handling of Wikidata)
- Version 15 September 2016
- Version 16 January 2017
- Version 17 May 2017
- Version 18 July 2017
- Version 19 August 2017
- Version 20 December 2017 (changed symbols for dot and micro)
- Version 21 January 2018 (remove many deprecated options)
- Version 22 February 2018 (many unit link changes)
- Version 23 June 2018 (warnings for ignored numbered parameters; adj=pre/disp=preunit changes; currency units removed)
- Version 24 May 2019 (hidden sort key uses data-sort-value; avoid using the extra data module)
- Version 25 May 2021 (use templatestyles Ашаблон:Fraction/styles.css or Ашаблон:Sfrac/styles.css for fractions)
- Version 26 June 2021 (many unit link changes)
- Version 27 February 2022 (enhance Mach parameters; use spaced en dash when needed; unit tweaks)
- Version 28 April 2023 (new SI prefixes; add disp=semicolon; unit adjustments including fixing scales of mpge and BTU/lb)
- Version 29 May 2023 (liter/litre fix to show symbol 'L' rather than 'l' per MOS)