Malline:Convert

Wikipediasta
Siirry navigaatioon Siirry hakuun
Mallineen ohje [näytä] [muokkaa] [päivitä]


Enwkin en:template:convert sivulta tuotu malline jonka tarkoitus on toimia identtisesti englanninkielisen version kanssa lukuunottamatta lyhyiden yksiköiden käyttöä vakioasetuksena. Suomenkielelle kotoistettu versio on {{muunna}}.

  • {{convert|2|km|mi}} → 2 km (1,2 mi)
  • {{convert|7|mi|km}} → 7 mi (11 km)

Tuetut yksiköt

[muokkaa wikitekstiä]

Lokalisointi

[muokkaa wikitekstiä]

Lokalisointiohjeet löytyvät englanninkielisen Wikipedian sivulta template:Convert/Transwiki_guide/translate. Muokattavat sivut ovat:

Tähän liittyvät moduulit

[muokkaa wikitekstiä]

Convert voi hakea ja muuttaa suoraan Wikidatasta tulevia arvoja input ja qid -parametreilla. Wikidata kohteet Cessna 208 (Q1056131) and kantama (P2073)

  • {{convert|input=P2073|qid=Q1056131|ftin|abbr=on}} → 1 500 mi (7 920 000 ft 0 in)
  • {{convert|input=P2073|qid=Q1056131|km|abbr=on}} → 1 500 mi (2 400 km)
  • {{convert|input=P2073|qid=Q1056131|km|abbr=on|disp=out}} → 2 400 km

Ominaisuutta on käytetty englanninkielisen Wikipedian tietolaatikossa template:Infobox Telescope.

Parameter Value Description Note
|abbr=in in Use symbol for first (left-hand side) unit Symbol ('abbreviation')
|abbr=off off Use name for all units Symbol ('abbreviation')
|abbr=none none
|abbr=on on Use symbol for all units Symbol ('abbreviation')
|abbr=out out Use symbol for right-hand side unit (default) Symbol ('abbreviation')
|abbr=unit unit Use symbol for all units when using scientific notation Symbol ('abbreviation')
|abbr=values values Show only input and output numbers, not units Parts only
|abbr=~ ~ Shows both unit name and symbol Symbol & name
|adj=mid|… mid User-specified text after the input unit; sets adj=on (adjective). Expects 1 unnamed parameter. Word adding, adjective
|adj=on on Unit name is adjective (singular and hyphenated) Grammar, adjective
|adj=pre|… pre User-specified text before input unit. Expects 1 unnamed parameter. Word adding
|adj=ri0 ri0 Round input with precision 0 Rounding and significant figures
|adj=ri1 ri1 Round input with precision 1 Rounding and significant figures
|adj=ri2 ri2 Round input with precision 2 Rounding and significant figures
|adj=ri3 ri3 Round input with precision 3 Rounding and significant figures
|comma=5 5 Only use comma for thousands separator if 5 or more digits Number format
|comma=gaps gaps Use gaps (space), not comma, for thousands separator Number format
|comma=off off No thousands separator Number format
|disp=b b Join input and output using " (...)" (default) Join values
|disp=sqbr sqbr Join input and output using " [...]" Join values
|disp=br br Join input and output using "<br/>" Join values
|disp=comma comma Join input and output using ", " Join values
|disp=or or Join input and output using " or " Join values
|disp=number number Display output number only Parts only
|disp=output number only output number only
|disp=out out Display only output number and name/symbol Parts only
|disp=output only output only
|disp=preunit|…[|…] preunit Text to be inserted after value and before units, for both input and output, with optionally different text for output. Expects 1 or 2 unnamed parameters. Word adding
|disp=table table Output is suitable for a table cell with align="right" Table columns
|disp=tablecen tablecen Output is suitable for a table cell with align="center" Table columns
|disp=unit unit Display input name/symbol only (not input number, not output) Parts only
|disp=unit2 unit2 Display output name/symbol only (not input; not output number) Parts only
|disp=x|... x Join input and output using user-specified text Word adding
|frac=N N Show imperial number in fractions, denominator=N Number format, fraction
|lk=in in Link left-hand side unit name or symbol Unit link
|lk=on on Link all unit names or symbols (but not twice for the same unit) Unit link
|lk=out out Link right-hand side unit name or symbol Unit link
|order=flip flip Inverts order of input, output measurements (conversion first) Order
|input=P2048 P2048 Reads and converts Wikidata property Inside template
|qid=Q1056131 Q1056131 Reads Wikidata property from Wikidata item Inside template
|round=5 5 Rounds calculation to the nearest multiple of 5 Rounding and significant figures
|round=25 25 Rounds calculation to the nearest multiple of 25 Rounding and significant figures
|round=each each In a range, each number is rounded by the default rounding Rounding and significant figures
|sigfig=N N Round output number to N significant figures (N is a positive integer) Rounding and significant figures
|sortable=on on Adds invisible sort key Table sort
|sp=us us Use U.S. spelling ("meter" instead of default "metre") Spelling U.S. names
|spell=in in Spell input number in words Spelling numbers
|spell=In In Spell input number in words with first letter uppercase Spelling numbers
|spell=on on Spell input and output numbers in words Spelling numbers
|spell=On On Spell input and output numbers in words with first letter uppercase Spelling numbers
|$= Replace $-sign with a currency sign, for example in $/acre (no currency conversion happens) Cost per unit
|debug=yes yes Debugging only. In a sortable table: show the normally hidden sort key Table sort
Malline:!mxt flip Deprecated. Use Malline:Mxt Order
Malline:!mxt Deprecated. Use Malline:Mxt Plurals

TemplateData

[muokkaa wikitekstiä]
Tärkeää: Älä käännä parametrien nimiä. Suomeksi lokalisoitu versio mallineesta on {{muunna}}


Converts measurements to other units.

Mallineen parametrit[Muokkaa mallinetietoja]

Tämä malline suosii yksirivistä muotoilua parametreille.

ParametriKuvausTyyppiTila
value1

the value to convert

Numeropakollinen
from unit2

the unit for the provided 'value'

Esimerkki
km
Rivipakollinen
to units3

the unit to convert into

Esimerkki
mi
Merkkijonoehdotettu
precision or suffix4

significant digits after decimal dot or, if negative, exponent of ten

Numerovalinnainen
link unitslk

“on” all, “in” input, “out” output or “off” no units

Oletusarvo
off
Esimerkki
on
Merkkijonovalinnainen
abbreviationabbr

display for the units: “on” unit symbols, “off” all unit names in full words, “in” input unit symbol, “out” abbreviated output units, “unit” both input and output units abbreviated when using scientific notation, “values” no units at all

Oletusarvo
off
Merkkijonovalinnainen
spellingsp

“us” display U.S. spelling of unit names

Esimerkki
us
Merkkijonovalinnainen
adjectiveadj

adjectival form (singular unit name appended by hyphen) “on” or “mid” to put conversion at end

Oletusarvo
off
Esimerkki
on
Totuusarvovalinnainen
conversiondisp

display conversion result: “or” after ‘or’, “x” with custom prefix and suffix, “b” in parentheses, “table”/“tablecen”, “output only” alone, “output number only” alone and without unit, “unit” not at all but input unit; if the value is a number it is used as precision

Esimerkki
b
Merkkijonovalinnainen
orderingorder

“flip” returns converted value first, input value second.

Esimerkki
flip
Merkkijonovalinnainen
significant figuressigfig

number that sets the number of significant figures

Numerovalinnainen
rounding outputround

“5” rounds the output number to nearest multiple of 5, “25” to nearest multiple of 25, “each” rounds each number in a range

Numerovalinnainen
thousands separatorcomma

Sets or suppresses thousand separator in the numbers. “off” = no separator; “gaps”: use space not comma; “5” and “gaps5”: only add separator when number > 5 positions (10,000 or more)

Oletusarvo
on
Esimerkki
off
Merkkijonovalinnainen
sort keysortable

“on” generates a hidden sort key

Esimerkki
on
Merkkijonovalinnainen

Esimerkkejä

[muokkaa wikitekstiä]
Convert/doc/range separator list
Separator Convert Result Notes
- {{convert|3|-|6|ft}} 3–6 ft (0,91–1,83 m) Input can be hyphen (-) or en dash (–), output uses en dash
 &ndash; (en dash) {{convert|3|–|6|ft}} 3–6 ft (0,91–1,83 m)
and {{convert|3|and|6|ft}} 3 and 6 ft (0,91 and 1,83 m)
& {{convert|3|&|6|ft}} 3 &[convert: unknown unit] Same as and
and(-) {{convert|3|and(-)|6|ft}} 3 and 6 ft (0,91–1,83 m) |abbr=on abbreviates the first unit
and(-)|abbr=on {{convert|3|and(-)|6|ft|abbr=on}} 3 and 6 ft (0,91–1,83 m)
or {{convert|3|or|6|ft}} 3 or 6 ft (0,91 or 1,83 m)
to {{convert|3|to|6|ft}} 3 to 6 ft (0,91 to 1,83 m)
to(-) {{convert|3|to(-)|6|ft}} 3 to 6 ft (0,91–1,83 m) |abbr=on abbreviates the first unit
to(-)|abbr=on {{convert|3|to(-)|6|ft|abbr=on}} 3 to 6 ft (0,91–1,83 m)
to about {{convert|3|to about|6|ft}} 3 to about 6 ft (0,91 to about 1,83 m)
+/- {{convert|3|+/-|6|ft}} 3 ± 6 ft (0,91 ± 1,83 m)
± &plusmn; {{convert|3|±|6|ft}} 3 ± 6 ft (0,91 ± 1,83 m)
+ {{convert|3|+|6|ft}} 3 + 6 ft (0,91 + 1,83 m)
, {{convert|3|,|6|ft}} 3, 6 ft (0,91, 1,83 m)
, and {{convert|3|, and|6|ft}} 3, and 6 ft (0,91, and 1,83 m)
, or {{convert|3|, or|6|ft}} 3, or 6 ft (0,91, or 1,83 m)
by {{convert|3|by|6|ft}} 3 by 6 ft (0,91 by 1,83 m)
x {{convert|3|x|6|ft}} 3 ft × 6 ft (0,91 m × 1,83 m) Scientific notation.
|abbr=on abbreviates the first unit
× &times; {{convert|3|×|6|ft}} 3 ft × 6 ft (0,91 m × 1,83 m)
x|abbr=on {{convert|3|x|6|ft|abbr=on}} 3 ft × 6 ft (0,91 m × 1,83 m)


Nämä on kopioitu suoraan enwikin templaten ohjeesta

  • {{convert|1|lb|kg|abbr=on}} → 1 lb (0,45 kg)
  • {{convert|1|lb|kg|abbr=off}} → 1 pound (0,45 kilogram)
  • {{convert|1|lb|kg}} → 1 lb (0,45 kg)
  • {{convert|1|lb|kg|abbr=on}} → 1 lb (0,45 kg)
  • A {{convert|10|mi|km|adj=on}} distance → A 10 mi (16 km) distance.
  • {{convert|10|mi|km}} to go → 10 mi (16 km) to go.

Pyöristykset

[muokkaa wikitekstiä]
Examples of rounding
Input Displays as Note
{{convert|123|ft|m|-1}} 123 ft (40 m)
{{convert|123|ft|m|0}} 123 ft (37 m)
{{convert|123|ft|m|1}} 123 ft (37,5 m)
{{convert|550|ft|m|0}} 550 ft (168 m) Approximate value is 167.64 m
{{convert|550|ft|m}} 550 ft (170 m) Rounds to 170, when approximate value is 167.64 m
{{convert|500|ft|m|0}} 500 ft (152 m) Approximate value is 152.4 m
{{convert|500|ft|m}} 500 ft (150 m) Rounds to 150, when approximate value is 152.4 m
  • {{convert|1200|ft|m|sigfig=4}} → 1 200 ft (365,8 m)
  • {{convert|1200|ft|m|sigfig=3}} → 1 200 ft (366 m)
  • {{convert|1200|ft|m|sigfig=2}} → 1 200 ft (370 m)
  • {{convert|1200|ft|m|sigfig=1}} → 1 200 ft (400 m)
  • {{convert|10|m|ft}} → 10 m (33 ft)
  • {{convert|10|m|ft|round=5}} → 10 m (35 ft)
  • {{convert|10|m|ft}} → 10 m (33 ft)
  • {{convert|10|m|ft|round=25}} → 10 m (25 ft)
  • {{convert|10|m|ft|sigfig=4}} → 10 m (32,81 ft)
  • {{convert|10 x 200 x 3000|m|ft}} → 10 m × 200 m × 3 000 m (33 ft × 656 ft × 9 843 ft)
  • {{convert|10 x 200 x 3000|m|ft|round=each}} → 10 m × 200 m × 3 000 m (33 ft × 660 ft × 9 800 ft)
  • {{convert|5.56|cm|in|frac=16}}5,56 cm (2+316 in)
  • {{convert|8|cm|in|frac=4}}8 cm (3+14 in)
  • {{convert|8|cm|in|frac=100}}8 cm (3+320 in)
  • {{convert|8|cm|in}} → 8 cm (3,150 in)

Useita yksiköitä

[muokkaa wikitekstiä]
  • {{convert|10|C|F K}} → 10 °C (50 °F; 283 K)
  • {{convert|5|km|mi nmi}} → 5 km (3,1 mi; 2,7 nmi)
  • {{convert|6|by|12|ft|m}} → 6 by 12 ft (1,8 by 3,7 m)
  • {{convert|6|x|12|m|ft}} → 6 m × 12 m (20 ft × 39 ft)
  • {{convert|6|x|12|m|ft|abbr=on}} → 6 m × 12 m (20 ft × 39 ft)
  • {{convert|1|ft|3|in|x|3|ft|5|in|mm}} → 1 ft 3 in ([convert: unknown unit])*
  • {{convert|1|ft|3|in|mm}} → 1 ft 3 in (380 mm)
  • {{convert|10|mi|m|spell=in}} → ten mi (16 000 m)
  • {{convert|10|mi|m|spell=on}} → ten mile (sixteen thousand metre)
  • {{convert|10|mi|m|spell=In}} → Ten mi (16 000 m)
  • {{convert|10|mi|m|spell=On}} → Ten mile (sixteen thousand metre)
  • {{convert|10|mi|m|spell=on|abbr=off|sp=us}} → ten mile (sixteen thousand meter)
  • {{convert|4|acre||adj=pre|planted}} → 4 planted acre (1,6 ha)
  • {{convert|4|acre||disp=preunit|planted }} → 4 planted acre (1,6 planted ha)
  • {{convert|4|acre||disp=preunit|planted |reforested-}} → 4 planted acre (1,6 reforested-ha)
  • {{convert|10|ft|m|adj=mid|-long}} → 10 ft-long (3,0 m)
  • {{convert|1|metre}} → 1 m (3 ft 3 in)
  • {{convert|2|metre}} → 2 m (6 ft 7 in)
  • {{convert|2|metre|abbr=on}} → 2 m (6 ft 7 in)
  • {{convert|100|foot|abbr=off}} → 100 foot (30 metre)
  • 12 Gm (1,2×1010 m)
  • 12 μm (1,2×10−5 m)
  • {{convert|12|Gm|mi|abbr=on}} → 12 Gm (7 500 000 mi)
  • Mm: 12 Mm (7 500 mi)
  • km: 12 km (39 000 ft)
  • mm: 12 mm (0,47 in)
  • μm: 12 μm (0,012 mm)
  • um: 12 μm (0,012 mm) (letter "u" can be used for "μ" here)
  • {{convert|12000|mi|Mm|abbr=on}} → 12 000 mi (19 Mm)
  • {{convert|12|in|μm|abbr=on}} → 12 in (300 000 μm)
  • {{convert|12|μm|μin|abbr=on}} → 12 μm (470 μin)
  • {{convert|7|e6m}} → 7×10^6 m (23 000 000 ft)
  • {{convert|23,000,000|ft|e6m}}[convert: invalid number]
  • {{convert|12.3e-15|atm|atm|abbr=on}} → 12,3×10−15 atm (1,23×10−14 atm)
  • {{convert|0.00000005|atm|atm|abbr=on}} → 0,00000005 atm (5,0×10−8 atm)
  • {{convert|1/2|in|mm|1}}12 in (12,7 mm)
  • {{convert|1⁄2|in|mm|1}}12 in (12,7 mm)
  • {{convert|2+1⁄2|in|mm|1}}2+12 in (63,5 mm)
  • {{convert|-2-1⁄2|in|mm|1}}−2+12 in (−63,5 mm)
  • {{convert|2-1⁄2|in|mm|1}}2–12 in (50,8–12,7 mm) Note: this is read as a range
  • {{convert|-2+1⁄2|in|mm|1}}[convert: invalid number] { Should be a number, not an expression (do not require a calculation)
  • {{convert|1//2|in|mm|1}}1/2 in (12,7 mm)
  • {{convert|2+1//2|in|mm|1}}2+1/2 in (63,5 mm)
  • {{convert|1234567|m|ft}} → 1 234 567 m (4 050 417 ft)
  • {{convert|1,234,567|m|ft}}[convert: invalid number]
  • {{convert|1 234 567|m|ft}}[convert: invalid number]
  • {{convert|1234567|m|ft|comma=off}} → 1234567 m (4050417 ft)
  • {{convert|1234567|m|ft|comma=gaps}}1234567 m (4050417 ft)
  • {{convert|1234567|m|ft}} → 1 234 567 m (4 050 417 ft)
  • {{convert|1234|m|ft|comma=5}} → 1234 m (4049 ft)
  • {{convert|1234567|m|ft|comma=5}} → 1 234 567 m (4 050 417 ft)
  • {{convert|1234|m|ft|comma=gaps5}} → 1 234 m (4 049 ft)*
  • {{convert|1234567|m|ft|comma=gaps5}} → 1 234 567 m (4 050 417 ft)*
  • {{convert|1234|m|ft}} → 1 234 m (4 049 ft)
  • {{convert|10|m|ft|disp=sqbr}} → 10 m [33 ft]
  • {{convert|10|m|ft|disp=comma}} → 10 m, 33 ft
  • {{convert|10|m|ft|disp=or}} → 10 m or 33 ft
  • {{convert|10|m|ft}} → 10 m (33 ft)
  • {{convert|10|m|ft|disp=br}} → 10 m
    33 ft
  • {{convert|10|m|ft|disp=br()}} → 10 m
    (33 ft)
  • {{convert|10|m|ft|disp=x|_MyText_}} → 10 m_MyText_33 ft—(To display spaces, use &nbsp;)
  • {{convert|1|mi|m}} → 1 mile (1 609,3 metre)
  • {{convert|10|km|mi nmi|order=flip}} → 6,2137 mile; 5,3996 nautical mile (10 kilometre)
  • {{convert|10|km|nmi mi|order=flip}} → 5,3996 nautical mile; 6,2137 mile (10 kilometre)

Näytetään vain osa tuloksesta

[muokkaa wikitekstiä]
Convert Output Description
{{convert|2|cuyd|m3}} 2 cu yd (1,5 m3) Default behaviour, for comparison
{{convert|2|cuyd|m3|abbr=values}} 2 (1,5) Input and output numbers
{{convert|2|cuyd|m3|disp=unit}} cu yd Input unit
{{convert|2|cuyd|m3|disp=unit|adj=on}} cu yd Input unit, adjective (hyphenated)
{{convert|2|cuyd|cuyd|0|disp=out|abbr=off}} 2 cubic yard Input (workaround)
{{convert|2|cuyd|m3|abbr=~}} 2 cubic yard [cu yd] (1,5 m3) Input: both name and symbol
{{convert|2|cuyd|m3|disp=unit2}} m3 Output unit (symbol)
{{convert|2|cuyd|m3|disp=unit2|abbr=off}} cubic metre Output unit (name)
{{convert|2|cuyd|m3|disp=number}} 1,5 Output value
{{convert|2|cuyd|m3|disp=out}} 1,5 m3 Output value and unit
{{convert|2|cuyd|m3|disp=out|abbr=off}} 1,5 cubic metre Output value and unit
  • {{convert|2|kPa|psi|abbr=~}} → 2 kilopascal [kPa] (0,29 psi)
  • A {{convert|2|kPa|psi|abbr=~|adj=on}} pressureA 2-kilopascal [kPa] (0,29 psi) pressure
  • {{convert|10|m|ft|disp=table}} → style="text-align:right;"|10

|style="text-align:right;"|33

  • {{convert|20|m|ft|disp=tablecen}} → style="text-align:center;"|20

|style="text-align:center;"|66

  • {{convert|1000|kg/hl}} → 1 000 kg/hl (100 lb/imp gal)
  • A rise of {{convert|10|C-change|F-change K-change}} → A rise of 10 °C (18 °F; 10 K)
  • {{convert|1|yd|2|ft|3|in}} → 1 yd 2 ft 3 in (1,60 m)
  • {{convert|2|ft|3|in|cm}} → 2 ft 3 in (69 cm)
  • {{convert|1|lb|5|oz|g}} → 1 lb 5 oz (600 g)
  • {{convert|2|m|ftin}} → 2 m (6 ft 7 in)
  • {{convert|2|m|ft in}} → 2 m (6,6 ft; 79 in), using a space, returns the decimal point
  • {{convert|2|m}} → 2 m (6 ft 7 in)
  • {{convert|10|$/mi|$/km}} → $10/mi ($6,2/km)
  • {{convert|10|$/mi|$/km|$=€}} → €10/mi (€6,2/km)

Seurantaluokat

[muokkaa wikitekstiä]