Template talk:Convert/Archive June 2012

Latest comment: 12 years ago by Wikid77 in topic Wonky miles per gallon


Clarification needed

When I do {{convert|20|-|35|km|mi|sp=us|adj=on}}, it results in "20–35-kilometer (12–22 mi)". Shouldn't the part in parentheses also display with a dash (i.e., "(12–22-mi)")? Is that a bug or a feature? Thanks.—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); June 6, 2012; 14:18 (UTC)

  • It is a feature which matches formal English usage: The omission of the adjective hyphen "-" with unit-symbol names (such as "3 mi funrun") is a quirk of formal English-language punctuation idioms. Logically, it would be more readable as a "500-ft descent" but perhaps the reasoning is that a unit symbol always connects to the prior number (with no hyphen needed to connect them), so in written text, the hyphen is almost always omitted with an adjective symbol, and we commonly see "9 mm handgun" (rarely "9-mm"). If Convert inserted the hyphen with unit-symbol adjectives, then some users would complain that Convert displayed "non-standard" English punctuation to force the hyphen. As a positive note, consider Convert's generated output to be the "formally correct" manner for displaying conversions with adjectives and unit symbols. -Wikid77 (talk) 11:20, 9 June 2012 (UTC)

Plural Units when less than 1

Hi-

Right now, if I {{convert|1/2|mi|km}} I get 12 mile (0.80 km). It would be nice when using fractions (not decimals) {>0, <= 1} to optionally suppress the plural. Right now, the only way I can see to do that is with abbr=on. Thanks. And after that, I'd like to {{convert|one-half|mi|km}} and get "one-half mile (0.08 km)" ☺ JMOprof (talk) 18:50, 11 June 2012 (UTC)

  • Options already available: Several other people have asked for similar options, so we have "adj=1" and {convert/spell} to show words:
  • Originally:   {{convert|1/2|mi|km}}          → 12 mile (0.80 km)
  • Non-plural: {{convert|1/2|mi|km|adj=1}} → 12 mile (0.80 km)*
  • Spellings: {{convert/spell |1/2|mi|km}} → one-half mile (0.80 km)
See: Help:Convert for other options. Due to the complexity, spellings are based on numeral inputs ("320"), and there are no plans to support the words; however, Google Search can do it, see: "Google for three hundred twenty miles". So, perhaps some day... -Wikid77 07:03, 13 June 2012 (UTC)
Wow! Thanks. That's perfect. Nice to know stuff. JMOprof (talk) 14:05, 13 June 2012 (UTC)

Wonky miles per gallon

{{convert|15|to|32|mpgus|l/100 km mpgimp}} is giving me: "15 to 32 miles per US gallon (15.7 to 7.4 l/100 km; 18 to 38 mpg‑imp)", which has "{{{n}}}" instead of the initial units. If we were only converting one rating, à la {{convert|15|mpgus|l/100 km mpgimp}}, it properly outputs "15 miles per US gallon (16 l/100 km; 18 mpg‑imp)". Can someone take a look at this? Thanks, Imzadi 1979  10:54, 20 June 2012 (UTC)

  • Use Convert/2 for non-supported ranges: Use {convert/2} or hand-code the conversion in the text. There are several units, among the current hundreds, which do not work in typical 2-number ranges. Instead, use Template:Convert/2 (which has almost no restrictions on unit ranges), but output as "l/100 km" (not both "l/100 km mpgimp"):
  • {{convert/2 |15|to|32|mpgus|l/100 km}} → {{convert/2|15|to|32|mpgus|l/100 km}}
  • {{convert/2 |15|to|32|mpgus|l/100 km mpgimp}} → {{convert/2|15|to|32|mpgus|l/100 km mpgimp}}
There are so many thousands of options with ranges, I have forgotten why the parameter for unit name, {{{n}}}, is not defined for those inverse mpgus units. It seems as though it would be easy to fix, but perhaps not, because the input is a mixed unit, of "miles" per "gallon". -Wikid77 (talk) 14:28, 20 June 2012 (UTC)

Re: {{convert/km}}

Template gives output in kilometres. Should be square kilometres.

I'm not quite sure what you mean but if you're looking for the square-kilometre subtemplate it's {{convert/km2}}. JIMp talk·cont 23:01, 5 June 2012 (UTC)