Template talk:Convert/Archive May 2019
![]() | This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Module version 24
Some changes to the convert modules are in the sandbox, and I intend switching the main modules to use the sandbox soon.
- Module:Convert • Module:Convert/sandbox • same content
- Module:Convert/data • Module:Convert/data/sandbox • same content
- Module:Convert/text • Module:Convert/text/sandbox • same content
- Module:Convert/extra • Module:Convert/extra/sandbox • different (diff)
- Module:Convert/wikidata • Module:Convert/wikidata/sandbox • same content
- Module:Convert/wikidata/data • Module:Convert/wikidata/data/sandbox • same content
The following examples use fixed wikitext to show the current output from {{convert/sandbox}} so it will not change in the future.
- Change hidden sort key to use data-sort-value
- The hidden sort key generated by
sortable=on
will change per request here. In addition,sortable=debug
can be used to display the key, rather thandebug=on
.{{convert|12.34|m|abbr=on|sortable=debug}}
→ 7001123400000000000♠12.34 m (40.5 ft){{convert|12.34|m|abbr=on|sortable=on}}
→ 12.34 m (40.5 ft)
- which is
<span data-sort-value="7001123400000000000♠"></span>12.34 m (40.5 ft)
- which is
- The hidden sort key generated by
- Avoid using the extra data module
- Module:Convert/extra is normally empty and what links here should not show any articles using it. However, previous versions of convert have been confused by output units such as
e3km e3mi
because convert triede3
ofkm e3mi
before trying the combination ofe3km
ande3mi
. The result was that the extra module was used to look upkm e3mi
. That will no longer happen although some peculiarities may still occur.{{convert|12.3|e3acre feet|e6m3 e6cuft|abbr=unit}}
→ 12.3 thousand acre⋅ft (15.2 million m3; 540 million cu ft) (does not use the extra module)
- Module:Convert/extra is normally empty and what links here should not show any articles using it. However, previous versions of convert have been confused by output units such as
- A space after a minus sign is an error
- Convert has accepted broken input such as
{{convert|- 10|°C|°F}}
which was in Kedarnath Wildlife Sanctuary. In an effort to require clean wikitext, that will now be an error.{{convert|- 10|°C|°F}}
→ [convert: invalid number]
- Convert has accepted broken input such as
- Input value NNNN will consistently give no output
- Some infoboxes offer wikitext such as
{{convert|NNNN|m}}
where it is understood thatNNNN
needs to be replaced with a number. Also, some editors put converts with no value into an article in the hope that the value will be inserted later. Errors in articles clutter the error tracking category so convert supportsNNN
(three or moreN
) as an input value which means "value is intentionally missing; show no output". Some options still gave an error. While the options are unlikely to be used, convert has been fixed to always output nothing.{{convert|NNNN|m|spell=in}}
→ (no output; previously was an error){{convert|NNNN|m|adj=ri2}}
→ (no output; previously was an error)
- Some infoboxes offer wikitext such as
- Wikidata labels updated
- Module:Convert/wikidata/data/sandbox lists units defined at Wikidata and which can be used in convert (for infoboxes). Some labels have been updated to match changes on Wikidata. Three unimportant inconsistencies remain as shown at Module talk:Convert/wikidata/data/sandbox. The labels are only a convenience and are not used by convert.
Release notes for earlier versions are listed here. Johnuniq (talk) 02:42, 2 May 2019 (UTC)
- Done, this version is now live. @Huntster: Per our previous discussion, you might like to know that output units like
e6km e6mi
now have no problems ande6km+e6mi
is not needed. Johnuniq (talk) 03:52, 4 May 2019 (UTC)
Default to Sortable=on?
I can't think of any reason why you'd want converted numbers sorted alphabetically instead of numerically; why is sortable=on not the default? I just had to make this edit to make the tables sort correctly which should seem to be necessary. Reywas92Talk 18:32, 16 May 2019 (UTC)
- @Reywas92:
|sortable=on
generates HTML code that's only needed in tables. For instance, here's the output of{{convert|100|m}}
from Special:ExpandTemplates. — Eru·tuon 19:45, 16 May 2019 (UTC) - Defaulting to sortable=on would add too much bloat to the HTML output. I know it's unfashionable to be concerned about efficiency but a very large number of converts have no need of a hidden sort key. A section above has some examples of the output. Johnuniq (talk) 23:23, 16 May 2019 (UTC)
U.S. Cup as unit?
I'd be interested in seeing the (U.S. customary) Cup (unit) as a unit - I have been adding convert templates to some culinary pages and I'm puzzled why we have US quart but not US cup. The archives only mention the cup as a convertible unit once (Template talk:Convert/Archive May 2009#More units we might want), but as this discussion was a decade ago, I think the "there's too many different types of cups" argument is inadequate. We already have a swathe of separate imperial and US customary units in Module:Convert/documentation/conversion_data (including gallon, pint, quart, kenning, and gill), so I'd feel the "too many supported units" ship has long since sailed.-Ich (talk) 11:25, 20 May 2019 (UTC)
- @Ich: I hope you don't mind but I moved your comment from Module talk:Convert to here because this is the page to discuss units. I will think about the issue later. Johnuniq (talk) 11:32, 20 May 2019 (UTC)
- @Johnuniq: Thanks - I actually had meant to put it on the template talk page.-Ich (talk) 12:09, 20 May 2019 (UTC)
- There is no standard cup. Recipe books used cups for measuring flour, sugar, raisins etc. because not everybody had weighing scales, but pretty much everybody had a cup of some sort. Although the relative proportions of the ingredients were important, the exact amounts were not critical. --Redrose64 🌹 (talk) 20:49, 20 May 2019 (UTC)
- That was back in the day. Most people nowadays use a plastic measuring cup. A cup is defined as 250 ml. The US cup is smaller. See Cup (unit). Hawkeye7 (discuss) 21:00, 20 May 2019 (UTC)
- Half a pint in the US and the UK, but then the pint differs! Specifically a US cup is 8 oz and a UK cup 10 oz. These measures are marked on measuring jugs and similar. Martin of Sheffield (talk) 21:15, 20 May 2019 (UTC)
- Cup (unit) mentions various official cups of 100 mL, 120 mL, 123 mL, 150 mL, 180 mL, 200 mL, 227 mL, 240 mL, 246 mL, 250 mL and half an imperial pint. Which is the official WP cup that doesn't conflict with various national standards? Or are we going to have separate unit names for each of the above? Stepho talk 22:30, 20 May 2019 (UTC)
- We have separate units for Imperial and US pints and gallons, I'd be interested in seeing units for "U.S. legal cup" (240 ml, 8 rounded fluid oz., used for food labeling and baking) and "metric cup" (250 ml, used in metric countries), and "U.S. customary cup" (236 ml, i.e. 8 unrounded US fluid oz). Cup (unit) notes that "imperial cup" (284 ml) and "Canadian cup" (227 ml) are either deprecated or rarely used; the Latin American cups are poorly-defined; according to Obsolete Russian units of measurement, Russian cups were phased out in 1925 (and "cup" doesn't appear on that page either). The Japanese cup (180 ml) could have its own unit if someone wants it. So that's "only" three cups. And now that I'm reading it - the "fluid oz. for food" isn't included in convert templates, so if we only had the 236-ml cup, we could generally compensate for the lack of the 240-ml cup with rounding in the template, rather than needing the third unit.-Ich (talk) 10:39, 21 May 2019 (UTC)
- There is no practical difference between 240 ml and 236 ml: does anyone fill a cup with the accuracy required so that would matter? Sorry to be difficult but there are a lot of unused units and it is traditional here to only accept new units which have an immediate need. That is, in what article (preferably more than one) would the unit be used, and for what text? Johnuniq (talk) 10:51, 21 May 2019 (UTC)
- We have separate units for Imperial and US pints and gallons, I'd be interested in seeing units for "U.S. legal cup" (240 ml, 8 rounded fluid oz., used for food labeling and baking) and "metric cup" (250 ml, used in metric countries), and "U.S. customary cup" (236 ml, i.e. 8 unrounded US fluid oz). Cup (unit) notes that "imperial cup" (284 ml) and "Canadian cup" (227 ml) are either deprecated or rarely used; the Latin American cups are poorly-defined; according to Obsolete Russian units of measurement, Russian cups were phased out in 1925 (and "cup" doesn't appear on that page either). The Japanese cup (180 ml) could have its own unit if someone wants it. So that's "only" three cups. And now that I'm reading it - the "fluid oz. for food" isn't included in convert templates, so if we only had the 236-ml cup, we could generally compensate for the lack of the 240-ml cup with rounding in the template, rather than needing the third unit.-Ich (talk) 10:39, 21 May 2019 (UTC)
- Cup (unit) mentions various official cups of 100 mL, 120 mL, 123 mL, 150 mL, 180 mL, 200 mL, 227 mL, 240 mL, 246 mL, 250 mL and half an imperial pint. Which is the official WP cup that doesn't conflict with various national standards? Or are we going to have separate unit names for each of the above? Stepho talk 22:30, 20 May 2019 (UTC)
- Half a pint in the US and the UK, but then the pint differs! Specifically a US cup is 8 oz and a UK cup 10 oz. These measures are marked on measuring jugs and similar. Martin of Sheffield (talk) 21:15, 20 May 2019 (UTC)
- That was back in the day. Most people nowadays use a plastic measuring cup. A cup is defined as 250 ml. The US cup is smaller. See Cup (unit). Hawkeye7 (discuss) 21:00, 20 May 2019 (UTC)
- There is no standard cup. Recipe books used cups for measuring flour, sugar, raisins etc. because not everybody had weighing scales, but pretty much everybody had a cup of some sort. Although the relative proportions of the ingredients were important, the exact amounts were not critical. --Redrose64 🌹 (talk) 20:49, 20 May 2019 (UTC)
- @Johnuniq: Thanks - I actually had meant to put it on the template talk page.-Ich (talk) 12:09, 20 May 2019 (UTC)
{@|Ich}}, you forgot to list the coffee cup - 120 mL in the US and 150 mL in Commonwealth countries (not sure which one Canada uses). The article seems to imply that US coffee makers can use either 120 or 150 mL. That brings the list back up to 5. You allowed for the modern Japanese cup of 200 mL but the traditional cup of 180 mL is still used for rice and sake. I will carefully measure my 2 Japanese rice cookers in the next few days to test this. Stepho talk 22:58, 21 May 2019 (UTC)
- No one is disputing that cups are made in different sizes. What is being discussed here the the cooks' measure of "a cup of flour" etc. That is half a pint (whatever the local pint is) or else some metric creation needed to retain a practical unit. I'm sure the SI don't approve of cups, so the metric versions can and should be ignored as "standard". That just leaves us with the US and the Imperial sizes, 8 floz and 10 floz respectively. However, I think the key phrase from the discussion above is Johnuniq's comment that "it is traditional here to only accept new units which have an immediate need", so let's all just wait untill a need can be demonstrated. Martin of Sheffield (talk) 08:07, 22 May 2019 (UTC)
Electric car efficiency
I was trying to convert 26 kWh/100 miles to 16 kWh/100 km. The closest I could get is {{convert|26|kWh/mi|kWh/km|abbr=on|0}} to give 26 kW⋅h/mi (16 kW⋅h/km). I can also use kWh/100km but the kWh/100miles is eluding me. Stepho talk 07:31, 25 May 2019 (UTC)
- Assuming that is a unit used by reliable sources, I added
100mi
to Module:Convert/extra so it can be trialed. Presumably you are sure sources don't use kWh/mi?{{convert|26|kWh/100mi|kWh/100km|abbr=off}}
→ 26 kilowatt-hours per 100 miles (16 kilowatt-hours per 100 kilometres){{convert|26|kWh/100mi|kWh/100km|abbr=on}}
→ 26 kWh/100 mi (16 kWh/100 km)
- Johnuniq (talk) 09:22, 25 May 2019 (UTC)
- US-specific "Monroney" statements use
kWh/100mi
File:Smart_ED_Monroney_sticker_WAS_2011_1126.jpg and Miles per gallon gasoline equivalent (MPGeEPA). —Sladen (talk) 09:40, 25 May 2019 (UTC)- Thanks, your links show that kWh/100mi is a well-established unit. I'm still mpg. Johnuniq (talk) 10:34, 25 May 2019 (UTC)
- Thanks, that looks like it will do the job. Can I use in articles or is it still provisional?
- And I feel like I'm being ungrateful, but is there a way to abbreviate "kWh" but spell out "miles" in full ('mi' always looked wrong to me, even though I know about 'm' being ambiguous with metres). Either way, I'm grateful for your help. Stepho talk 12:55, 25 May 2019 (UTC)
- Thanks, your links show that kWh/100mi is a well-established unit. I'm still mpg. Johnuniq (talk) 10:34, 25 May 2019 (UTC)
- US-specific "Monroney" statements use
I agree it looks bad so I added 100miles
as an alternative. Both can be used now. In a few weeks the units will be changed to "permanent" status provided they are used in a couple of articles.
{{convert|1|kWh/100mi|kWh/100km|abbr=on}}
→ 1 kWh/100 mi (0.62 kWh/100 km){{convert|2|kWh/100mi|kWh/100km|abbr=on}}
→ 2 kWh/100 mi (1.2 kWh/100 km){{convert|1|kWh/100miles|kWh/100km|abbr=on}}
→ 1 kWh/100 miles (0.62 kWh/100 km){{convert|2|kWh/100miles|kWh/100km|abbr=on}}
→ 2 kWh/100 miles (1.2 kWh/100 km){{convert|1|kWh/100mi|kWh/100km|abbr=off}}
→ 1 kilowatt-hour per 100 miles (0.62 kilowatt-hours per 100 kilometres){{convert|2|kWh/100mi|kWh/100km|abbr=off}}
→ 2 kilowatt-hours per 100 miles (1.2 kilowatt-hours per 100 kilometres){{convert|1|kWh/100miles|kWh/100km|abbr=off}}
→ 1 kilowatt-hour per 100 miles (0.62 kilowatt-hours per 100 kilometres){{convert|2|kWh/100miles|kWh/100km|abbr=off}}
→ 2 kilowatt-hours per 100 miles (1.2 kilowatt-hours per 100 kilometres){{convert|1|kWh/100km|kWh/100mi|abbr=on}}
→ 1 kWh/100 km (1.6 kWh/100 mi){{convert|2|kWh/100km|kWh/100mi|abbr=on}}
→ 2 kWh/100 km (3.2 kWh/100 mi){{convert|1|kWh/100km|kWh/100miles|abbr=on}}
→ 1 kWh/100 km (1.6 kWh/100 miles){{convert|2|kWh/100km|kWh/100miles|abbr=on}}
→ 2 kWh/100 km (3.2 kWh/100 miles){{convert|1|kWh/100km|kWh/100mi|abbr=off}}
→ 1 kilowatt-hour per 100 kilometres (1.6 kilowatt-hours per 100 miles){{convert|2|kWh/100km|kWh/100mi|abbr=off}}
→ 2 kilowatt-hours per 100 kilometres (3.2 kilowatt-hours per 100 miles){{convert|1|kWh/100km|kWh/100miles|abbr=off}}
→ 1 kilowatt-hour per 100 kilometres (1.6 kilowatt-hours per 100 miles){{convert|2|kWh/100km|kWh/100miles|abbr=off}}
→ 2 kilowatt-hours per 100 kilometres (3.2 kilowatt-hours per 100 miles)
Please check the above. Johnuniq (talk) 04:09, 26 May 2019 (UTC)
- Thank you very much, that works beautifully. I used kWh/100miles at Tesla Model 3 and kg/100miles at Toyota Mirai. Stepho talk 11:55, 27 May 2019 (UTC)