सामग्रीमा जानुहोस्

ढाँचा:Convert

Wiktionaryबाट
[edit] [purge] Template documentation

This template shows measurement quantities as primary and converted secondary units (or ranges), with optional rounding, wikilinks, abbreviation, or US spellings, and various separators including:  parentheses "( )", slash, "or", hyphens, comma, "to" or dashes. Styles include: distance "३२ metre (१०५ ft)" and "३२ metre वा १०५ feet"; temperature "१८ °C (६४ °F)" or "१८ °C / ६४ °F"; weight "५५.० किलोg (१२१.३ lb)" or "६५ बाट ८० किलोg (१४३ बाट १७६ lb)"; etc. For units see: Convert/list of units.

Options include:  lk=in, abbr=on, abbr=none, sp=us, adj=on, adj=mid, disp=x, disp=table and sortable=on (explained below). By default, output is rounded to match the precision of input; alternatives include: sigfig=3 or using the end parameter, such as "|1" to show tenths or "|-2" to show full 100's, etc.

Single value:

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

Range of values (see below for list of range options):

{{convert|orig_val1|range|orig_val2|original_unit|conversion_unit|round_to|...}}
  • Numbers must be entered in unformatted form (without commas). For negative numbers (i.e. temperatures or precision) use a hyphen as the minus sign for the input number. Values output by the template will be displayed formatted and with a true minus sign where appropriate. To specify with commas, re-code a number as {{formatnum:9,000,500|R}} (becomes 9000500).
  • Optional parameters, in examples below, allow abbreviated units (abbr=on), or US spellings (sp=us for meter), or slash separation (disp=s), or hyphenation (adj=on), etc.
  • For this template many levels of substitution are possible, hence doing this fully, step by step, is cumbersome. Use Special:ExpandTemplates instead.
  • The template has no in-built capacity for dimensional analysis. It is therefore up to the user to ensure that the input and output units are compatible. Do not, for example, attempt to convert barrels to tonnes (but see {{bbl to t}}). Also beware of units with similar names; the code oz, for example, is for the avoirdupois ounce (a unit of mass), do not use this if you want fluid ounces.
  • An attempt to convert a unit to itself (e.g. km to km), will result in a template loop.
  • The range functionality is not fully implemented for all units, so experimentation may be required.
  • This documentation page tends to lag behind in terms of what the template can do. For details see the talk page and its archives.
Input Displays as
{{convert|3.21|kg|lb}} ३.२१ किलोgram (७.१ lb)
{{convert|3.21|kg|lb|0}} ३.२१ किलोgram (७ lb)
{{convert|10|kg |lb |disp=or}} १० किलोgram वा २२ pound
{{convert|6|ft|5|in|m}} ६ feet ५ inches (१.९६ m)
{{convert|10|mi}} १० mile (१६ किलोm)
{{convert|100|mpgus}} १०० mile प्रति US gallon (२.४ L/१०० किलोm; १२० mpg‑imp)
{{convert|120|km/h}} १२० kilometres per hour (७५ mph)
{{convert|18|°C|°F}} १८ °C (६४ °F)
{{convert|1250|sqft|m2|lk=in|sigfig=2}} १,२५० square feet (१२० m2)
Note 'lk=in' links only the input unit. This example is for illustration only, common units of measurement should not be linked. See: wp:overlink.
{{convert|20.5|m3|cuyd|lk=out|abbr=on}} २०.५ m3 (२६.८ cu yd)
Note 'lk=out' links only the output unit, cu yd.
{{convert|641|acre|km2 sqmi|lk=on}} ६४१ acre (२.५९ किलोm2; १.००२ sq mi)
Note 'lk=on' links all units. Per guidelines, common units should not be linked. See: wp:overlink.
{{convert|641|acre|km2 sqmi|2|lk=on}} ६४१ acre (२.५९ किलोm2; १.०० sq mi)
Although 640 acres equals 1 square mile; 641 acres rounded to two decimal places equals 1.00 sq mi.
Note: not yet operational for all units
Input Displays as
{{convert|60|and|170|kg|lb}} ६० र १७० किलोgram (१३० र ३७० lb)
{{convert|60|to|170|kg|lb}} ६० बाट १७० किलोgram (१३० बाट ३७० lb)
{{convert|60|to(-)|170|kg|lb}} ६० बाट १७० किलोgram (१३०–३७० lb)
{{convert|60|-|170|kg|lb}} ६०–१७० किलोgram (१३०–३७० lb)
{{convert|41|to|50|F|C}} ४१ बाट ५० °F (५ बाट १० °C)
{{convert|41|-|50 |F|K}} ४१–५० °F (२७८–२८३ K)
{{convert|60|x|120|m|ft}} ६० × १२० metre (२०० ft × ३९० ft)
{{convert|60|+/-|10|m|ft}} ६० ± १० metre (१९७ ± ३३ ft)
{{convert|19|to|27|L|USgal}} १९ बाट २७ litre (५.० बाट ७.१ US gal)
{{convert|5|to|7|L|USgal|abbr=mos}} ५ litre बाट ७ litre (१.३ बाट १.८ US gal)
{{convert|4|-|9|L|USgal|abbr=none}} ४–९ litre (१.१–२.४ US gallon)
{{convert|30|-|40|mpg}} ३०–४० mpg[convert: संदिग्धार्थ एकाई]
{{convert|7|-|9|L100km}} ७–९ L100km[convert: अज्ञात एकाई]

The following conversions are currently not available as a range of values:

  • Some imperial and US gallon-based units
  • Other fuel-consumption units, except "mpg" or "L100km" shown above.
  • Large scale units (e3, e6, e9)
  • Combination-based units (ft&in, st&lb, lb&oz) due to complexity of the conversion.
Parameters
ढाँचा:anchorUse US spelling attach |sp=us
ढाँचा:anchorMake units wikilinked attach |lk=on   to link all unitsढाँचा:in5(default: lk=off)
attach |lk=in   to link only the input units
attach |lk=out  to link only the output units
(The manual of style suggests that you should not link common units of measurement).
ढाँचा:anchorUse the adjective form, or insert mid-text words attach |adj=on (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 Manual of Style).
attach |adj=mid (e.g. "The 190-foot bridge (58 m)" as: |adj=mid|bridge, or "The 190-foot-long bridge (58 m)" as: |adj=mid|-long bridge)
ढाँचा:in5Any rounding-parameter should follow the mid-text: "text|0".
ढाँचा:anchorAbbreviate units, or not attach |abbr=onढाँचा:in5to show unit symbolsढाँचा:in5(default: abbr=off)
attach |abbr=none   to show all unit names in full words
attach |abbr=in ढाँचा:in5 to abbreviate input units
attach |abbr=outढाँचा:in5to abbreviate output units
attach |abbr=valuesढाँचा:in5to suppress unit names & show only values. So, {{convert|6|mi|abbr=values}} gives: ६ (९.७).
ढाँचा:anchorChange "( )" to display other separators attach |disp=commaढाँचा:in5to put comma, not brackets/parentheses
attach |disp=orढाँचा:in5to put "or" between units
attach |disp=s (or |disp=/) for slash (e.g. 190 foot/58 metre). The default value is:  disp=b for brackets/parentheses.
Change "( )" to customized separators attach |disp=x| (begin | end)ढाँचा:in5to show "xx (begin yy end)"
attach |disp=x|;ढाँचा:in5to show "xx; yy"
attach |disp=x| (same as |)ढाँचा:in5to show "xx (same as yy)".
Display output only attach |disp=output only ढाँचा:in5 to show result number & unit
attach |disp=output number onlyढाँचा:in5to show just number
Note when using "disp=output only" then the unit name can still be shown as full words by abbr=none, or linked by lk=on.
Display units inverted as reverse order attach |disp=flip ढाँचा:in5 to reverse the order & show output unit first
So, {{convert|6|km|disp=flip}} shows "3.2 mi (6 kilometres)".
To get symbol "km" use abbr=in, to abbreviate the input unit.
Display unit name (only) attach |disp=unit ढाँचा:in5 to show the unit name for a symbol
The unit name will be plural when the amount is not 1, or hyphenated when adj=on. So, {{convert|2|cuyd|disp=unit}} shows "cubic yards" plural.
ढाँचा:anchorDisplay amounts as table cells attach |disp=table (or |disp=tablecen) 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 |abbr=on, |lk=on, |lk=in or |lk=out. Example: here
Round to a specified number of significant figures attach |sigfig={some non-negative integer}. 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.
Round by 5 attach |disp=5  to round the output amount to the nearest 5 units. Not supported for all options.
Let Convert decide the unit to convert to skip the precision parameter (the 3rd or 4th unnamed parameter) e.g. {{convert|100|km|kn}} gives १०० किलोmetre ([convert: एकाई कुमेलन]) and {{convert|100|km}} gives १०० किलोmetre (३,३०,००० ft).
Display input value with a fraction {{convert|3/8|in|mm|3|abbr=on}}  in (९.५२५ मिलीm) or {{convert|11+1/4|in|cm|2|abbr=on}}११  in (२८.५८ बाटन्टिm)

For negative amounts, use 2 minus signs: -11-1/4.

ढाँचा:anchorGenerate a hidden sort key for use with a sortable table attach |sortable=on to generate a hidden sort key (in the form of <span style="display:none">00000005</span>) so that sortable tables will sort correctly. This takes the first numeric value and left pads it with zeros to 16 places. It ignores any additional values, ie, if you use 6|ft|2|in as the value, it will only use the 6 for the sort key. This will cause numeric values to sort in numeric order, ie: 5, 10, 15 instead of 10, 15, 5.

Parameters still under construction

[सम्पादन गर्नुहोस्]
Parameters still under construction. May not work in all situations
Round by 5 attach |disp=5  to round output to nearest 5 units. Might not work when linking unit names.
disp=tablecen Similar to disp=table except that the values with be centered within the column. See the tables at La Nouvelle branch, BM-21 Grad for in use examples.
disp=comma Similar to disp=s except the two values will be separated by a comma, for situations where the first value is already within parentheses. See the Geography tables on Labrador for an example.
abbr=in Abbreviates only the input unit.
abbr=out Abbreviates only the output unit.
abbr=comma Abbreviates (removes) commas. This is a limited, temporary option, until comma=off can be implemented. For ranges, using abbr=comma conflicts with internal options, so instead, append "nocomma" to a range-word: tonocomma, bynocomma, andnocomma, -nocomma & xnocomma.
abbr=mos For ranges, abbreviates with the input unit repeated, twice. Not to be confused with the specifications at .

Convert supports four types of rounding:

Rounding to a given precision
Specify the desired precision with the fourth unnamed parameter (or third unnamed parameter if the "convert to" parameter is omitted; or fifth unnamed parameter if a range is specified; or fourth unnamed parameter again if a range is specified and the "convert to" parameter is omitted; needs to be replaced with a "precision" named parameter). The conversion is rounded off to the nearest power of ढाँचा:frac 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 |sigfig={some non-negative integer} 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 digits after the decimal point—or the negative of the number of non-significant zeroes before the point—is increased by one if the conversion is a multiplication by a number between 0.02 and 0.2, remains the same if the factor is between 0.2 and 2, is decreased by 1 if it is between 2 and 20, and so on) 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 kelvins, whichever is the most precise.
See also: Convert/list of units

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. {{convert|55|nmi|km mi}} produces "५५ nautical mile (१०२ किलोm; ६३ mi)".

  • {{Convinfobox}} for use in infoboxes
  • {{Bbl to t}} for converting barrel of oil to tonnes
  • {{CwtQtrLb to kg}} for converting long hundred weights, quarters and pounds into kilograms
  • {{Decdeg}} for converting degrees, minutes and seconds to decimal degrees
  • {{HMS2Deg}} for converting hour angles, given in hours, minutes and seconds, to decimal degrees
  • {{Height}} for converting and displaying a person's height
  • {{Miles-chains}} for converting miles and chains to kilometres linking "chains"
  • {{Pop density}} for converting a population and area to a density
  • {{Inflation}} for calculating inflation of Consumer Price Index related prices
  • {{Metricate}}
  • {{RailGauge}} for converting rail (track) gauges