Difference between revisions of "Template:Convert/doc"

From Teampedia
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
+
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
{{Documentation subpage|種類=[[Help:テンプレート|テンプレート]]}}
+
</noinclude><includeonly>
+
{{複雑なテンプレート}}
+
{{#ifeq:{{#titleparts:{{FULLPAGENAME}}|1|}}|Template:Convert2
+
|{{混同|Template:Convert|x1=機能と使用法はほぼ同じですが、テンプレート版の}} {{lua|モジュール:Convert}}
+
|{{混同|Template:Convert2|x1=機能と使用法はほぼ同じですが、Luaモジュールを使用している}}
+
}}
+
</includeonly>
+
 
__NOTOC__
 
__NOTOC__
{{Infobox
+
==Purpose==
| title =  
+
| data1 = {{Infobox
+
        | child = yes
+
        | title = [[Special:Whatlinkshere/{{#titleparts:{{FULLPAGENAME}}|1|}}{{!}}{{#titleparts:{{FULLPAGENAME}}|1|}}を使用している記事一覧]]
+
        | label1 =
+
        | data1 =
+
        }}
+
| below = <!--最下部テキスト-->
+
}}
+
==Template purpose==
+
This is a template for converting numbers with units to another unit and writing them together. For example, a unit of weight[[G]](g)を[[グレーン]](gr)という単位に置き換えるには、<nowiki>{{convert|10|g|gr}}</nowiki>Will write {{convert|10|g|gr}}, side by side.
+
Initially, when I copied the English version of the article,
+
{{font|color=red|Template:Convert/DWton}}If it appears like this, it means that the internal template has not been ported to the English version yet, and to display it, you may need to port it yourself or wait for someone to port it. did. In addition, in some cases, multiple templates had to be ported, even if it appeared to be a single template.
+
  
If it appears like this, it means that the internal template has not been ported to the Japanese version yet, and to display it, you may need to port it yourself or wait for someone to port it. did. In addition, in some cases, multiple templates had to be ported, even if it appeared to be a single template.
+
To show quantities in a primary and secondary display, such as {{convert|32|m|ft|1}}, or {{convert|18|°C|°F|1}}.
  
However, the English version of Wikipedia has shifted to using Lua modules, and internal templates are no longer used.{{tl|convert2}}
+
== Usage ==
 +
<tt><nowiki>{{</nowiki>convert|''original_value''|''original_unit''|''conversion_unit''|''round_to''<nowiki>}}</nowiki></tt>
  
It is better to rewrite it.
+
== Examples ==
 
+
This template is used relatively frequently in the English version. When creating a new conversion formula, make sure that there are no similar templates in the English version. In particular, do not create a template with the same title as the English version but another meaning.
+
==Example==
+
<!--For a single number:--><!-- Left character, omit until you write an example of the range-->
+
 
{| class="wikitable"
 
{| class="wikitable"
!変換!!記法!!表示
+
|'''Input'''||'''Displays as'''
!Convert!!Notation!!Show
+
|
+
||kilometers to Miles||<nowiki>{{convert|18.75|km|mi}}</nowiki>||{{convert|18.75|km|mi}}
+
 
|-
 
|-
|From kilogram to pound||<nowiki>{{convert|3.215|kg|lb}}</nowiki>||{{convert|3.215|kg|lb}}
+
|<nowiki>{{convert|32|m|ft|0}}</nowiki>||{{convert|32|m|ft|0}}
 
|-
 
|-
|単位を略号にする場合||<nowiki>{{convert|3.215|kg|lb|abbr=on}}</nowiki>||{{convert|3.215|kg|lb|abbr=on}}
+
|<nowiki>{{convert|18|°C|°F|1}}</nowiki>||{{convert|18|°C|°F|1}}
 
|-
 
|-
|さらに単位の記事への内部リンクを作成||<nowiki>{{convert|3.215|kg|lb|lk=on|abbr=on}}</nowiki>||{{convert|3.215|kg|lb|lk=on|abbr=on}}
+
|<nowiki>{{convert|10|mi|km|0}}</nowiki>||{{convert|10|mi|km|0}}
 
|-
 
|-
|表示を"/"区切りで並べる場合||<nowiki>{{convert|3.215|kg|lb|disp=s}}</nowiki>||{{convert|3.215|kg|lb|disp=s}}
+
|<nowiki>{{convert|25|km|mi|0}}</nowiki>||{{convert|25|km|mi|0}}
 
|-
 
|-
|単位の前に"-"を付ける場合||<nowiki>{{convert|3.215|kg|lb|adj=on}}</nowiki>||{{convert|3.215|kg|lb|adj=on}}
+
|<nowiki>{{convert|1|lb|kg|0}}</nowiki>||{{convert|1|lb|kg|0}}
 
|-
 
|-
|小数点以下1桁となるよう四捨五入する場合||<nowiki>{{convert|3.215|kg|lb|1}}</nowiki>||{{convert|3.215|kg|lb|1}}
+
| <nowiki>{{convert|1250|sqft|sqm|1|lk=on}}</nowiki> ||{{convert|1250|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|abbr=on}}
 
|-
 
|-
|(変換後の単位を省略すると、最も一般的な単位に変換する)||<nowiki>{{Convert|7|lb}}</nowiki>||{{Convert|7|lb}}
+
|<nowiki>{{convert|641|acre|sqmi|3|lk=on|abbr=on}}</nowiki>||{{convert|641|acre|sqmi|3|lk=on|abbr=on}}
 
|-
 
|-
|誤差を併記する場合||<nowiki>{{convert|60|+/-|10|m|ft}}</nowiki>||{{convert|60|+/-|10|m|ft}}
+
|''However''||
 
|-
 
|-
|複数単位への変換<br/>(スペースで区切って並べる)||<nowiki>{{convert|1|R|C F K}}</nowiki>||{{convert|1|R|C F K|lk=on}}
+
|<nowiki>{{convert|641|acre|sqmi|2|lk=on|abbr=on}}</nowiki>||{{convert|641|acre|sqmi|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.
 
|}
 
|}
'''注意'''
 
*上記のスイッチ(abbr=onとか)は、その組み合わせ毎にテンプレートを作っています。そのため、スイッチのon、offの組み合わせによっては新たにテンプレートを作成または移植する必要があります。
 
*複数単位への変換の場合もその組み合わせに対応するテンプレートを新たに作成する必要がある場合があります。
 
  
<!--まだ赤リンクばかりだから省略
+
===Tricks===
範囲の指定:
+
 
{| class="wikitable"
 
{| class="wikitable"
|'''Input'''||'''Displays as'''
 
 
|-
 
|-
|<nowiki>{{convert|60|and|170|kg|lb}}</nowiki>||{{convert|60|and|170|kg|lb}}
+
! colspan="2" | <big>'''In order to...'''</big>
 
|-
 
|-
|<nowiki>{{convert|60|to|170|kg|lb}}</nowiki>||{{convert|60|to|170|kg|lb}}
+
| Use [[United States|U.S.]] spelling || attach <code><nowiki>|sp=us</nowiki></code>
 
|-
 
|-
|<nowiki>{{convert|60|to(-)|170|kg|lb}}</nowiki>||{{convert|60|to(-)|170|kg|lb}}
+
| Make units [[Wikipedia:Manual of Style (links)|wikilinked]] || attach <code><nowiki>|lk=on</nowiki></code> (The [[WP:MOS|manual of style]] suggests that you only link the first instance).
 
|-
 
|-
|<nowiki>{{convert|60|-|170|kg|lb}}</nowiki>||{{convert|60|-|170|kg|lb}}
+
| Use the singular for grammar || attach <code><nowiki>|sing=on</nowiki></code> (ex: "The 190 foot (58 m) bridge" as opposed to "feet")
 
|-
 
|-
|<nowiki>{{convert|60|by|120|m|ft}}</nowiki>||{{convert|60|by|120|m|ft}}
+
| Abbreviate all units || attach <code><nowiki>|abbr=on</nowiki></code>
 
|-
 
|-
|<nowiki>{{convert|60|x|120|m|ft}}</nowiki>||{{convert|60|x|120|m|ft}}
+
| Use a / instead ( ) || attach <code><nowiki>|disp=slash</nowiki></code> (or shorthand: <code><nowiki>|disp=/</nowiki></code>) (ex: 190&nbsp;foot/58&nbsp;m)
|-
+
|<nowiki>{{convert|60|+/-|10|m|ft}}</nowiki>||{{convert|60|+/-|10|m|ft}}
+
|}-->
+
 
+
===変換精度===
+
変換後の精度は入力の精度に依存します。
+
 
+
{| class="wikitable"
+
!入力の精度!!記述例!!表示
+
|-
+
|1||<nowiki>{{convert|1|R|K}}</nowiki>||{{convert|1|R|K}}
+
|-
+
|1.0000||<nowiki>{{convert|1.0000|R|K}}</nowiki>||{{convert|1.0000|R|K}}
+
|-
+
|1.00000000||<nowiki>{{convert|1.00000000|R|K}}</nowiki>||{{convert|1.00000000|R|K}}
+
 
|}
 
|}
  
==英語版から移植する場合の注意==
+
===Rounding===
*通常の移植と同様に、[[Wikipedia:FAQ 翻訳]]、[[Wikipedia:翻訳のガイドライン]]をよくお読みのうえ、要約欄に必要事項を記載してください。以下はそれに付け加えての注意です。
+
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.
  
*[[:en:Template:Convert/ft]](21:37, 29 March 2008の版)を例にとると、ソースは
+
== Conversions ==
::<nowiki>{{convert/{{#ifeq:{{{4}}}|in|and/in|{{{d}}}}}|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|s={{{s|}}}|r={{{r}}}|d={{{d}}}</nowiki>
+
The abbreviations to the right of the units are the abbreviations that can be 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}}.
::|u=ft
+
----
::|n=foot
+
::|l=feet
+
::|t=Foot (length)
+
::|o=m
+
::|b=0.3048
+
::|j=-0.515985037-{{{j|0}}}}}<nowiki><noinclude>{{pp-template|small=yes}}</nowiki>
+
::<nowiki>[[Category:Subtemplates of Template Convert]]</nowiki>
+
::<nowiki></noinclude></nowiki>
+
:となっています。そのままコピーしても一応動作しますが、
+
:*<nowiki>{{pp-template}}または{{pp-template|small=yes}}</nowiki>は、英語版で「影響が大きいため保護されているテンプレート」を意味しますので、日本語版では削除してください。(現在のところ、日本語版の<nowiki>{{pp-template}}</nowiki>は「何もしない」設定になっています。)
+
:*tで始まる引数(上の例では「t=Foot (length)」)は、単位の説明記事への内部リンクの記事名ですので、これは日本語版の相当する記事名(上の例では「[[フィート]]」)に変更する必要があります。引数tがない場合には引数nの文字で代用されます。
+
:*nで始まる引数とlで始まる引数(上の例では「n=foot」と「l=feet」)は、省略せずに(abbr=offで)書いた場合の表示単位です。引数nは結果が1(単数)の場合、引数lは結果が1以外の場合に表示されます。引数lを省略した場合で、結果が1以外の場合には、単位の末尾に複数形の「s」が付きます。そのため、引数nを日本語に訳す場合には、必ず引数lも定義してください(通常は引数nと同じ文字でよい)。
+
:*<nowiki><noinclude></noinclude></nowiki>の間に、英語版への言語間リンクを記載してください。
+
:*上記の例の場合、例えば
+
::<nowiki>{{convert/{{#ifeq:{{{4}}}|in|and/in|{{{d}}}}}|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|s={{{s|}}}|r={{{r}}}|d={{{d}}}</nowiki>
+
::|u=ft
+
::|{{font|color=red|n=フィート}}
+
::|{{font|color=red|l=フィート}}
+
::|{{font|color=red|t=フィート}}
+
::|o=m
+
::|b=0.3048
+
::|j=-0.515985037-{{{j|0}}}}}<nowiki><noinclude></nowiki>
+
::<nowiki>[[Category:Subtemplates of Template Convert]]</nowiki>
+
::{{font|color=red|<nowiki>[[en:Template:Convert/ft]]</nowiki>}}
+
::<nowiki></noinclude></nowiki>
+
:とするとよいでしょう。
+
<!--
+
===Tricks===
+
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! colspan="2" | <big>'''In order to...'''</big>
+
! colspan="5" | <big>Units supported by {{tl|convert}}</big>
 
|-
 
|-
| Use [[United States|US]] spelling || attach <code><nowiki>|sp=us</nowiki></code>
+
| '''system''' || '''unit''' || '''abbreviation ''used in coding'''''<br> (alternative abbreviations) || '''abbreviation ''printed''''' || [[Image:Flag of the United States.svg|20px]] '''US spelling''' <code><nowiki>|sp=us</nowiki></code>
 
|-
 
|-
| Make units [[Wikipedia:Manual of Style (links)|wikilinked]] || attach <code><nowiki>|lk=on</nowiki></code> to link all units<br> attach <code><nowiki>|lk=in</nowiki></code> to link only the input units<br> attach <code><nowiki>|lk=out</nowiki></code> to link only the output units<br>(The [[Wikipedia:Only make links that are relevant to the context|manual of style]] suggests that you should not link common units of measurement).
+
! 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 ||
 
|-
 
|-
| Use the adjective form || attach <code><nowiki>|adj=on</nowiki></code> (e.g. "The 190-foot (58 m) bridge" as opposed to "The 190 feet..."). This produces the adjective form—the unit name in the singular with a hyphen (according to the [[WP:HYPHEN|Manual of Style]]).
+
! 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 ||
 
|-
 
|-
| Abbreviate all units || attach <code><nowiki>|abbr=on</nowiki></code>
+
! colspan="5" style="font-size: 110%; text-align: left;" | '''Speed'''
|-
+
|- style="font-size: 90%;"
| Use a / instead of ( ) || attach <code><nowiki>|disp=s</nowiki></code> (or  <code><nowiki>|disp=/</nowiki></code>) (e.g. 190&nbsp;foot/58&nbsp;metre).  Note that when using slashes all unit names either spelt out in full or abbreviated (where there exists an abbreviation).
+
| style="text-align: center;" | '''SI''' || [[metres per second]] || m:s (m/s) || m/s || meter per second
|-
+
|- style="font-size: 90%;"
| Use in a table || attach <code><nowiki>|disp=table</nowiki></code> Note: For use in tables the template must start on a new line after a pipe.  Only the number will be displayed unless you set <code><nowiki>|abbr=on</nowiki></code>, <code><nowiki>|lk=on</nowiki></code>, <code><nowiki>|lk=in</nowiki></code> or <code><nowiki>|lk=out</nowiki></code>. Example: [[Phnom_Penh#Highways_in_Phnom_Penh|here]]
+
| 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;"
| Round to a specified number of significant figures|| attach <code><nowiki>|sigfig={some non-negative integer}</nowiki></code>. In the case of temperatures Celsius or Fahrenheit this refers to the difference with the absolute-zero temperature. For example, at room temperature two significant digits means rounded to tens of degrees.
+
| 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 ||
 
|-
 
|-
| Let ''Convert'' decide the unit to convert to|| skip the ''convert to'' parameter (which would otherwise be third unnamed parameter) e.g. <code><nowiki>{{convert|100|mi|0}}</nowiki></code> gives ''{{convert|100|mi|0}}''.
+
! 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 ||
 
|}
 
|}
 
===Rounding===
 
''Convert'' supports four types of rounding.
 
;Rounding to a given precision
 
:Specify the desired precision with the fourth unnamed parameter or third unnamed parameter in the case where the ''convert to'' parameter is skipped (see above).  The conversion is rounded off to the nearest power of 1/10 this 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.
 
 
;Rounding to a given number of significant figures
 
:Specify the desired number of significant figures using <code><nowiki>|sigfig={some non-negative integer}</nowiki></code> as noted above.
 
 
;Combine both of the above
 
:If both the desired precision and the desired number of significant figures are specified, the conversion will be rounded to the least precise of these.
 
 
;Default rounding
 
:If neither the desired precision nor the desired number of significant figures are specified, the conversion will be rounded either to a comparable precision as the input value (the number of decimals remains the same if the conversion is a multiplication by a number between 0.2 and 2, is decreased by 1 if the factor is between 2 and 20, etc.) or to two significant figures whichever is the most precise.  An exception to this is temperature wherein the conversion will be rounded either to precision comparable to that of the input value or to that which would give three significant figures when expressed in kelvin, whichever is the most precise.
 
 
==Units supported by <nowiki>{{Convert}}</nowiki>==
 
The table below lists units supported by this template.  It is divided up according to the quantity being measured.  Not all supported units are listed here, there are links to complete lists for each quantity.
 
 
The codes listed in the ''code'' column (column 3) are accepted as input by the template.
 
These can be used as the second or third unnamed parameter.  For some units there exist alternative codes. These are listed in brackets and have been incorporated to make the code more flexible for editors, e.g. °F ''or'' F may be entered.
 
 
The codes listed in the ''combinations'' column (column 7) can be used to produce multiple conversions.  They can only be used as the third unnamed parameter, e.g. <code><nowiki>{{convert|55|nmi|km mi}}</nowiki></code> produces ''{{convert|55|nmi|km mi}}''.
 
 
Without box: [[Template:Convert/list of units]].
 
 
<div style="height: 400px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; reflist4" >
 
{{Convert/list of units}}
 
</div>
 
  
 
==Example/monitor page==
 
==Example/monitor page==
 
Monitor quality or look at examples at [[Template:Convert/check]]
 
Monitor quality or look at examples at [[Template:Convert/check]]
  
==See also==
 
* {{tl|Inflation}} template for calculating inflated prices in USA, UK and other countries.
 
-->
 
 
<includeonly>
 
<includeonly>
{{#ifeq:{{#titleparts:{{FULLPAGENAME}}|1|}}|Template:Convert2
+
<!-- ADD CATEGORIES BELOW THIS LINE -->
|{{Navbox Convert|2}}
+
[[Category:SI unit templates|{{PAGENAME}}]]
|{{Navbox Convert|1}}
+
[[Category:Conversion templates| ]]
}}
+
<!-- ADD INTERWIKIS BELOW THIS LINE -->
<!-- カテゴリーはここに記載する -->
+
[[no:Mal:Convert]]
{{DEFAULTSORT:Convert}}
+
[[zh:Template:Convert]]
[[Category:単位関連のテンプレート]]
+
 
[[Category:数学関数テンプレート]]
+
[[Category:特殊効果テンプレート]]
+
[[Category:変換テンプレート]]
+
 
</includeonly>
 
</includeonly>

Latest revision as of 16:44, 11 April 2020


Purpose

To show quantities in a primary and secondary display, such as 32 metres (105 ft), or 18 °C (64.4 °F).

Usage

{{convert|original_value|original_unit|conversion_unit|round_to}}

Examples

Input Displays as
{{convert|32|m|ft|0}} 32 metres (105 ft)
{{convert|18|°C|°F|1}} 18 °C (64.4 °F)
{{convert|10|mi|km|0}} 10 miles (16 km)
{{convert|25|km|mi|0}} 25 kilometres (16 mi)
{{convert|1|lb|kg|0}} 1  (Expression error: Unexpected round operator. )
{{convert|1250|sqft|sqm|1|lk=on}} 1,250 square feet (116.1 )
{{convert|20.5|sqkm|sqmi|1|lk=on|abbr=on}} 20.5 km² (7.9 sq mi)
{{convert|641|acre|sqmi|3|lk=on|abbr=on}} 641 acres (1.002 sq mi)
However
{{convert|641|acre|sqmi|2|lk=on|abbr=on}} 641 acres (1 sq mi) because 640 acres equals one square mile; 641 acres rounded to 2 would equal 1.00 sq mi. Therefore it is displayed as 1 sq mi.

Tricks

In order to...
Use U.S. spelling attach |sp=us
Make units wikilinked attach |lk=on (The manual of style suggests that you only link the first instance).
Use the singular for grammar attach |sing=on (ex: "The 190 foot (58 m) bridge" as opposed to "feet")
Abbreviate all units attach |abbr=on
Use a / instead ( ) attach |disp=slash (or shorthand: |disp=/) (ex: 190 foot/58 m)

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 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 {{convert}}.


Units supported by {{convert}}
system unit abbreviation used in coding
(alternative abbreviations)
abbreviation printed 20px US spelling |sp=us
Area
SI square metre sqm square meter
square kilometre sqkm km² square kilometer
Imperial & U.S. Customary acre acre acre (or acres)
square foot sqft sq ft
square yard sqyd sq yd
square mile sqmi sq mi
square nautical mile sqnmi sq nmi
old metric hectare ha ha
Length
SI millimetre mm mm millimeter
centimetre cm cm centimeter
metre m m meter
kilometre km km kilometer
Imperial & U.S. Customary inch in in
foot ft ft
yard yd yd
mile mi mi
nautical mile nmi nmi
Other astronomical unit AU AU
Speed
SI metres per second m:s (m/s) m/s meter per second
kilometres per hour km:h (km/h or kph) km/h kilometer per hour
Accepted non-SI knot knot kt
Imperial & U.S. Customary feet per second ft:s (ft/s) ft/s
miles per hour mi:h (mph or mi/h) mph
Temperature
SI kelvin K K
degrees Celsius °C (C) °C
Imperial & U.S. Customary degrees Rankine °R (R) °R
degrees Fahrenheit °F (F) °F

Example/monitor page

Monitor quality or look at examples at Template:Convert/check