Changes

Jump to: navigation, search

Template:Convert/doc

5,231 bytes added, 14:44, 11 April 2020
no edit summary
This template converts measurements from one unit and presents the results.<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->__NOTOC__==Purpose==
For example:To show quantities in a primary and secondary display, such as {{convert|32|m|ft|1}}, or {{convert|18|°C|°F|1}}.
== Usage == <tt><nowiki>{{t|</nowiki>convert|1''original_value''|km''original_unit''|mi}} → {{convert''conversion_unit''|1|km|mi''round_to''<nowiki>}}<br/nowiki></tt>{{t|convert|7|mi|km}} → {{convert|7|mi|km}} ;UsageBasic examples:
== Examples ==
{| class="wikitable"
|'''Input'''||'''Displays as'''
|-
|<nowiki>{{convert|3.2132|kgm|lbft|0}}</nowiki>||{{convert|3.2132|m|kgft|lb0}}
|-
|<nowiki>{{convert|3.2118|kg°C|lb°F|01}}</nowiki>||{{convert|3.2118|kg°C|lb°F|01}}
|-
|<nowiki>{{convert|10|kgmi|lbkm|disp=or0}}</nowiki>||{{convert|10|kgmi|lbkm|disp=or0}}
|-
|<nowiki>{{convert|625|ftkm|5mi|in|m0}}</nowiki>||{{convert|625|ftkm|5mi|in|m0}}<!--This is currently broken
|-
|<nowiki>{{convert|21|mlb|ftinkg|0}}</nowiki>||{{convert|21|mlb|ftinkg|0}}-->
|-
|<nowiki>{{convert|101250|misqft|sqm|1|lk=on}}</nowiki>||{{convert|101250|sqft|sqm|1|lk=on}} |- |<nowiki>{{convert|20.5|sqkm|sqmi|1|lk=on|abbr=on}}</nowiki>||{{convert|20.5|sqkm|sqmi|1|lk=on|miabbr=on}}
|-
|<nowiki>{{convert|100641|mpgusacre|sqmi|3|lk=on|abbr=on}}</nowiki>||{{convert|100641|acre|sqmi|3|lk=on|mpgusabbr=on}}
|-
|<nowiki>{{convert''However''|120|km/h}}</nowiki>||{{convert|120|km/h}}
|-
|<nowiki>{{convert|18641|°Cacre|°Fsqmi|2|lk=on|abbr=on}}</nowiki>||{{convert|18641|°Cacre|°Fsqmi|2|lk=on|abbr=on}}because 640 acres equals one square mile; 641 acres rounded to 2 would equal 1.00&nbsp;sq&nbsp;mi. Therefore it is displayed as 1&nbsp;sq&nbsp;mi.|} ===Tricks==={| class="wikitable"
|-
! colspan="2" |<nowikibig>{{convert|-15|C|F}}'''In order to...'''</nowikibig>||{{convert|-15|C|F}}
|-
|<nowiki>{{convertUse [[United States|9U.S.]] spelling |e6USgal|abbr=off}}attach <code></nowiki>||{{convert|9|e6USgal|abbrsp=off}}us<br/nowiki>The "e6" scales the input to millions; the "abbr=off" yields the "mega" in the output.<br/code>Scaling is only available for Single value conversions. Not all units are supported.
|-
| Make units [[Wikipedia:Manual of Style (links)|wikilinked]] || attach <code><nowiki>{{convert|1250|sqft|m2|lk=in|sigfig=2}}on</nowiki> ||{{convert|1250|sqft|m2|lk=in|sigfig=2}}<br/code>(The [[WP:MOS|manual of style]] suggests that you only link the first instance).
|-
|Use the singular for grammar || attach <code><nowiki>{{convert|20.5|m3|cuyd|lk=out|abbrsing=on}}</nowiki>||{{convert|20.5|m3|cuyd|1|lk=out|abbr=on}}<br/code>Note 'lk=out' links only the output unit, [[cu yd]].(ex: "The 190 foot (58 m) bridge" as opposed to "feet")
|-
|Abbreviate all units || attach <code><nowiki>{{convert|641|acre|ha sqmi|lkabbr=on}}</nowiki>||{{convert|641|acre|ha sqmi|lk=on}}</code>
|-
|Use a / instead ( ) || attach <code><nowiki>{{convert|641|acre|ha sqmi|2|lkdisp=on}}slash</nowiki></code> (or shorthand: <code><nowiki>||{{convert|641|acre|ha sqmi|2|lkdisp=on}}/<br/nowiki> Although 640 acres equals 1 square mile; 641 acres rounded to two decimal places equals 1.00</code>) (ex: 190&nbsp;sqfoot/58&nbsp;mi.m)
|}
More documentation ===Rounding===The number given for rounding rounds off the result to the power of 1/10 the rounding number. For instance, if the result is 8621 and the round number is '-2', the result will be 8600. If the result is '234.0283043' and the round number is '0', the result will be 234. == Conversions ==The abbreviations to the right of the units are the abbreviations that can be found at entered when using the template. Through various revisions of this template, some units have incorporated multiple abbreviations to make the code more flexible for editors, e.g. °F ''or'' F may be entered. Though they may not be the correct abbreviations, the ''correct abbreviation'' will always be displayed when you use {{tl|convert}}.----{| class="wikitable"|-! colspan="5" | <big>Units supported by {{tl|convert}}</big>|-| '''system''' || '''unit''' || '''abbreviation ''used in coding'''''<br> (alternative abbreviations) || '''abbreviation ''printed''''' || [[wikipediaImage:Flag of the United States.svg|20px]] '''US spelling''' <code><nowiki>|sp=us</nowiki></code>|-! colspan="5" style="font-size: 110%; text-align: left;" | '''Area'''|- style="font-size: 90%;"| style="text-align: center;" | '''[[International System of Units|SI]]''' || [[square metre]] || sqm || m² || square meter|- style="font-size: 90%;"| style="text-align: center;" | → || [[square kilometre]] || sqkm || km² || square kilometer|- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | '''[[Imperial system|Imperial]] & [[United States customary units|U.S.&nbsp;Customary]]''' || [[acre]] || acre || acre (or acres) |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[square foot]] ||sqft || sq&nbsp;ft |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[square yard]] ||sqyd || sq&nbsp;yd |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[square mile]] || sqmi || sq&nbsp;mi |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[square nautical mile]] || sqnmi || sq&nbsp;nmi |||- style="font-size: 90%;"| style="text-align: center;" | '''old metric''' || [[hectare]] || ha || ha |||-! colspan="5" style="font-size: 110%; text-align: left;" | '''Length'''|- style="font-size: 90%;"| style="text-align: center;" | '''SI''' || [[millimetre]] || mm || mm || millimeter|- style="font-size: 90%;"| style="text-align: center;" | → || [[centimetre]] || cm || cm || centimeter|- style="font-size: 90%;"| style="text-align: center;" | → || [[metre]] || m || m || meter|- style="font-size: 90%;"| style="text-align: center;" | → || [[kilometre]] || km || km || kilometer|- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | '''Imperial & U.S.&nbsp;Customary''' || [[inch]] || in || in |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[foot (unit of length)|foot]] || ft || ft |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[yard]] || yd || yd |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[mile]] || mi || mi |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[nautical mile]] || nmi || nmi |||- style="font-size: 90%;"| style="text-align: center;" | '''Other''' || [[astronomical unit]] || AU || AU |||-! colspan="5" style="font-size: 110%; text-align: left;" | '''Speed'''|- style="font-size: 90%;"| style="text-align: center;" | '''SI''' || [[metres per second]] || m:s (m/s) || m/s || meter per second|- style="font-size: 90%;"| style="text-align: center;" | → || [[kilometres per hour]] || km:h (km/h ''or'' kph)|| km/h || kilometer per hour|- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | '''Accepted ''non''-SI''' || [[knot (speed)|knot]] || knot || kt |||- style="font-size: 90%;"| style="text-align: center;" | '''Imperial & U.S.&nbsp;Customary''' || [[feet per second]] || ft:s (ft/s) || ft/s |||- style="font-size: 90%;"| style="text-align: center;" | → || [[miles per hour]] || mi:h (mph ''or'' mi/h) || mph |||-! colspan="5" style="font-size: 110%; text-align: left;" | '''Temperature'''|- style="font-size: 90%;"| style="text-align: center;" | '''SI''' || [[kelvin]] || K || K |||- style="font-size: 90%;"| style="text-align: center;" | → || [[degrees Celsius]] || °C (C) || °C |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | '''Imperial & U.S.&nbsp;Customary''' || [[degrees Rankine]] || °R (R) || °R |||- style="font-size: 90%; background-color: #FFFFFF;"| style="text-align: center;" | → || [[degrees Fahrenheit]] || °F (F) || °F |||} ==Example/monitor page==Monitor quality or look at examples at [[Template:Convert/doccheck]] <includeonly><!-- ADD CATEGORIES BELOW THIS LINE -->[[Category:SI unit templates|{{PAGENAME}}]][[Category:Conversion templates| ]]<!-- ADD INTERWIKIS BELOW THIS LINE -->[[no:Mal:Convert]][[zh:Template:Convert]].
<includeonly>[[Category:Experimental templates|{{PAGENAME}}]][[Category:Inline templates]]</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>



Navigation menu