Template talk:Convert
|
This page has archives. Sections older than 45 days may be automatically archived by Lowercase sigmabot III when more than 1 section is present. |
Plural abbreviations?
I notice that 8 pounds is abbreviated to 8 lbs not 8 lb. Is there a reason for this? Can it be changed (please)?
Ewen (talk) 12:20, 31 January 2008 (UTC)
- I don't see where you are seeing this. In the actual code it is written as |u=lb (for convert/lb) and |o=lb (for convert/kg). Therefore it can only be lb.
{{convert|8|lb|abbr=on}} --> 8 lb (3.6 kg)
{{convert|8|kg|abbr=on}} -->8 kg (18 lb)
- I think Ewen means this sort of thing - 10 st 8 lb (67 kg) {{convert|10|st|8|lb|kg|abbr=on}} when converting from stone/pounds to metric. •Florrie•leave a note• 14:01, 31 January 2008 (UTC)
- That's the fella! Sorry it wasn't clear. Any ideas? Ewen (talk) 14:04, 31 January 2008 (UTC)
- Yeap, I found the error in Template:Convert/and/lb and fixed it. Thanks Florrie. —MJCdetroit (yak) 16:36, 31 January 2008 (UTC)
Rounding causing template error
In the WWII article, {{convert|600|mi|km|−2}} is presently coming up with "600 miles (Expression error: Unrecognised punctuation character "�" km)". I expect there are other places this is showing up. Can somebody take a look please? If there is a better attention getter than {{editprotected}}, please change. --J Clear (talk) 22:47, 1 February 2008 (UTC)
- The error is in the template calls: for negative input numbers use a hyphen as the minus sign.--Patrick (talk) 00:57, 2 February 2008 (UTC)
- Since I only noticed the error on WWII (since corrected by User:Bigbluefish), I'm curious as to what the offending character is and how it got in the article, visually I see no difference. Since the obvious keys on the PC keyboard generates the correct character, at least on my US PC keyboard, it seems like someone went an extra step to get it wrong. Not to mention not previewing their changes on a protected page. After a bit of detective work, it looks like a "figure dash", UTF-8 E2 80 92. I wonder what combination of keyboard or key bindings does that. Maybe I'll track down the "offending" editor and let them know. --J Clear (talk) 16:01, 2 February 2008 (UTC)
Feet and inches not precisely converted
6 feet 4 inches (1.93 m) ({{convert|6|ft|4|in|m|sigfig=3}}) is correct but 6 feet 4 inches (1.93 m) ({{convert|6|ft|4|in|m}}) is assumed. As 1 inch is 2.54 cm then rounding to the nearest 10 cm seems wrong...
Ewen (talk) 14:26, 2 February 2008 (UTC)
- Try it like this:
- 5 ft 11 in (1.80 m)
{{convert|5|ft|11|in|2|abbr=on|lk=on}}
- 6 ft 4 in (1.93 m)
{{convert|6|ft|4|in|2|abbr=on|lk=on}}
- You just need the 2 for decimal places. •Florrie•leave a note• 14:35, 2 February 2008 (UTC)
- 5 ft 11 in (1.80 m)
- That's neater, thanks Florrie. I still contend that the default for ft & in to metres should be 2 dp not 1. Ewen (talk) 15:26, 2 February 2008 (UTC)
- The number of decimals (compared with those of inches) is increased by 1, because the factor 0.0254 is between 0.02 and 0.2, see above. A range from 0.03 to 0.3 could also be defended, with the geometric mean closer to 0.1, in which case we would get the extra decimal, being in the range from 0.003 to 0.03.--Patrick (talk) 15:36, 2 February 2008 (UTC)
- Yes, 0.003 to 0.03 ... i.e. 3 × 10n + 1 to 3 × 10n for interger n generally would be defensible. On the other hand, strictly speaking, to avoid any false precision, we should use 1 × 10n + 1 to 1 × 10n. For example, strictly speaking, since inches are bigger than centimetres, you should round to decimetres. Similarly, nautical miles should go to 10 km and even metres to 10 yd. However, we're generally not as strict as that when we do conversions so I made some allowance for increased precision. The line had to be drawn somewhere, though, and I chose 2 ... or if you're a stickler for precision, I chose 100.3010299957. So metres go to yards, nautical miles to kilometres, etc. but 2.54 is just out of range so inches still go to decimetres but I'm not saying that that 2 is set in stone or anything. Jɪmp 02:54, 4 February 2008 (UTC)
- I suppose you mean "to avoid any false precision, we should use 1 × 10n - 1 to 1 × 10n". Note however, with any such rule, if a result is e.g. 534 we cannot be sure that the true value is between 533.5 and 534.5, because if the given number multiplied by the conversion factor is 533.5, the actual value may be less.--Patrick (talk) 09:53, 4 February 2008 (UTC)
Conversion imprecision
At Tyrone Wheatley something seems to be wrong with {{convert}}. What might it be?--TonyTheTiger (t/c/bio/WP:CHICAGO/WP:LOTD) 21:34, 2 February 2008 (UTC)
- I didn't see a problem. Could you provide more details? —MJCdetroit (yak) 15:00, 3 February 2008 (UTC)
- It seems to be fixed now. It had been converting 235 lbs to 107 kg, 233 lbs to 106 and 230 to 100, with the latter being out of whack.--TonyTheTiger (t/c/bio/WP:CHICAGO/WP:LOTD) 20:20, 3 February 2008 (UTC)
Fails on zero values (km→mi)
The Convert macro appears to fail on zero values;
{{convert|0|km|mi}}
→0 kilometres (0 mi)
with the converted result "(Expression error: Unexpected < operator mi)". —Sladen (talk) 13:18, 4 February 2008 (UTC)
- The default rounding relies on determination of the order of magnitude of the converted value. 0 × 1000 ÷ 1609.344 has an infinitely small order of magnitude. Thus {{ordomag}} is giving an error message. The error message is passed on to {{max/2}} which produces another error message which in turn is passed on to {{rnd}} to give the message you see. If ... for some reason I really can't imagine ... you want to convert 0 sometings to 0 something elses (don't worry temperatures are safe) you can avoid all this by specifying the number of decimal places you want (don't bother with
sigfig
, it'll give you the same problem).
{{convert|0|km|mi|0}}
→0 kilometres (0 mi)
- Thanks for the answer, AFAICT, the returned order of magnitude should be 0 (zero), just as with the other single-digit integer values in the range -9..+9.
- I just had a quick look and trying to follow through; is the call sequence
"Ordomag"→"Ordomag/+"→"Ordomag"
recursively? Use cases are very easy to find; tables of numbers, route/distances maps—any instance where the data has come from an external source and consistent, reliable presentation is required. - The easiest fix I think would be to adjust to the initial if statement
x<0 ? ordo(x) : ordo(-x)
to bex<0 ? ordo(x) : (x>0 ? ordo(-x) : 0)
or some variation on that. Or to check if altering a comparision from '<
'→'<=
' could be made at a lower level? —Sladen (talk) 19:30, 4 February 2008 (UTC)- I made a change [1] to fix it.--Patrick (talk) 01:14, 5 February 2008 (UTC)
Convert template needed
The template will not convert miles and chains to km at the moment. Can this be sorted? A chain is 22 yards, btw (80 chains=1mile). It would look somethin like {{convert|2|mi|chain|km}} and give an answer something like - 2 miles, 17 chains (3.56 kilometres). — Preceding unsigned comment added by Mjroots (talk • contribs) 22:00, 4 February 2008 (UTC)
- It would look more like
{{convert|2|mi|17|chain|km}}
(you forgot the 17) and would give an answer more like 2 miles 17 chains (3.6 km) (the default would be to round chains up to the nearest hectometre). But are chains all that common these days? Jɪmp 23:40, 4 February 2008 (UTC)
- No, they're not that common, except for measuring distances on railways in the UK. See this discussion (or rather, heated argument) for the background to this. It would greatly help if that functionality could be added to this template (if only to keep certain editors quiet). --RFBailey (talk) 02:03, 5 February 2008 (UTC)
- Currently {{convert|2|mi|17|chain|km}} gives 2 miles (3.2186880000000 km) Mjroots (talk) 08:29, 5 February 2008 (UTC)
- No, they're not that common, except for measuring distances on railways in the UK. See this discussion (or rather, heated argument) for the background to this. It would greatly help if that functionality could be added to this template (if only to keep certain editors quiet). --RFBailey (talk) 02:03, 5 February 2008 (UTC)
- It's not functional yet and thus is converting 2 miles to kilometres with a precision of 17 decimal places. Jɪmp 17:19, 5 February 2008 (UTC)
- Is it likely to be functional any time soon? --RFBailey (talk) 01:23, 7 February 2008 (UTC)
- As soon as one of the admins replaces {{convert/mi}}'s current code with the following.
{{convert/{{#ifeq:{{{4}}}|chain|and/chain|{{{d}}}}}|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|s={{{s|}}}|r={{{r}}}|d={{{d}}} |u=mi |n=mile |o=km |b=1609.344 |j=3.206648885-{{{j|0}}}}}<noinclude>{{pp-template}} [[Category:Subtemplates of Template Convert]] </noinclude>
- Though it might need debugging & won't do slashes or tables yet. Jɪmp 05:45, 7 February 2008 (UTC)
- {{convert|2|mi|17|chain|km}}--->2 miles 17 chains (3.6 km)
- Done and I've temporarily changed the protection level to allow debugging. —MJCdetroit (yak) 13:02, 7 February 2008 (UTC)
- That's great--thanks! --RFBailey (talk) 13:38, 7 February 2008 (UTC)
horsepower conversions
Just noticed that PS metric horsepower is included in template, is it possible to add third unit to conversion, like kW> PS and bhp (what is used in GB) as results? --— Typ932T | C 23:29, 6 February 2008 (UTC)
- Sure, do you want PS and bhp or just PS and hp ... or both? Jɪmp 00:08, 7 February 2008 (UTC)
- Well Im not sure what combinations should be, maybe both, bhp is missing from auto templates, what about torque: kgm to Nm and ftlbf? --— Typ932T | C 00:18, 7 February 2008 (UTC)
- bhp would maybe good to get as kW and PS, there is so many combinations PS,hp,bhp,kw that all cant be included comes too long results? --— Typ932T | C 00:46, 7 February 2008 (UTC)
- To the best of my knowledge the difference between bhp and hp is simply a matter of where you're doing the measurement with the former being specific and the latter general. Thus, they are not different units. This was the assumption made when bhp was added to the template. Therefore you wouldn't have a combination which included both hp and bhp. Indeed, the following might suffice.
kW PS
kW hp
kW bhp
PS hp
PS bhp
- With respect to torque, yes, a
Nm ftlbf
combination would be useful for conversions from kgf·m. I wonder whether kilogram-force-metres are common enough to warrantNm kgfm
andkgfm ftlbf
. Jɪmp 05:40, 7 February 2008 (UTC)
- To the best of my knowledge the difference between bhp and hp is simply a matter of where you're doing the measurement with the former being specific and the latter general. Thus, they are not different units. This was the assumption made when bhp was added to the template. Therefore you wouldn't have a combination which included both hp and bhp. Indeed, the following might suffice.
- bhp would maybe good to get as kW and PS, there is so many combinations PS,hp,bhp,kw that all cant be included comes too long results? --— Typ932T | C 00:46, 7 February 2008 (UTC)
- I think only kgm to Nm ftlbf is enough, no need to get kgm --— Typ932T | C 08:20, 7 February 2008 (UTC)
- Done. Jɪmp 00:24, 8 February 2008 (UTC)
- Tested It gives 110 kW 150 bhp and 150 PS should be like something like 147 bhp? --— Typ932T | C 00:42, 8 February 2008 (UTC)
- I see with rounding 1 it gives 110 kW (149.6 PS/147.5 bhp) --— Typ932T | C 00:53, 8 February 2008 (UTC)
- It's reading the 110 kW as 110 ± 5 kW and rounding accordingly. Yes, if you want greater (or less) precision specify it (as you have). Setting precision to 0 gives "110 kilowatts (150 PS; 148 bhp)". Note, you can also specify the number of significant figures by using
|sigfig=
. Jɪmp 02:55, 8 February 2008 (UTC)
- It's reading the 110 kW as 110 ± 5 kW and rounding accordingly. Yes, if you want greater (or less) precision specify it (as you have). Setting precision to 0 gives "110 kilowatts (150 PS; 148 bhp)". Note, you can also specify the number of significant figures by using
- I see with rounding 1 it gives 110 kW (149.6 PS/147.5 bhp) --— Typ932T | C 00:53, 8 February 2008 (UTC)
- Tested It gives 110 kW 150 bhp and 150 PS should be like something like 147 bhp? --— Typ932T | C 00:42, 8 February 2008 (UTC)
- Done. Jɪmp 00:24, 8 February 2008 (UTC)
miles+yards→km
Just tried to do {{convert|1|mi|176|yd|km}} on Solway Junction Railway, which doesn't work at present. The yards were a multiple of 22, so I switched it to miles:chains for the moment. —Sladen (talk) 21:25, 11 February 2008 (UTC)
- No, miles & yards don't work as yet. Jɪmp 00:01, 12 February 2008 (UTC)
m → ft and in?
Any chance of getting the template to convert metres to feet and inches rather than just a decimal figure in feet? — Cheers, JackLee –talk– 14:43, 12 February 2008 (UTC)
- Like this?:
{{convert|10|m|ftin|}}-->10 metres (32 ft 10 in) (BTW:in decimal it would be 32.8 ft)
- because it already exists. —MJCdetroit (yak) 15:24, 12 February 2008 (UTC)
Oh, fantastic. I had tried "{{convert|10|m|ft in}}" but that didn't work. Is what you mentioned stated in the usage notes? I didn't see anything about it in them. — Cheers, JackLee –talk– 15:54, 12 February 2008 (UTC)
- I just added it to the "short list" which shows up on the template doc page. However, I could not figure out how to add it to the "full list". Jimp will have to do that at some point. —MJCdetroit (yak) 16:52, 12 February 2008 (UTC)
Much appreciated. — Cheers, JackLee –talk– 17:51, 12 February 2008 (UTC)
Support for ranges?
Are ranges supported in this template? I'd like the text to read "1 to 2 miles (1.6 to 3.2 km)". I find this to be much more readable than "1 mile (1.6 km) to 2 miles (3.2 km)." How can I do this? Simishag (talk) 08:21, 13 February 2008 (UTC)
- Not yet but I'll be working on it. Jɪmp 07:23, 14 February 2008 (UTC)
- Cool! I'd offer to help but I'm not sure I understand the template system. I do have some suggestions for functionality:
- A "range" should be just 2 values separated by a comma (or whatever). Anything with 3 values or more is not appropriate for this template, which might simplify things a bit.
- There should be an option for the word to use for "to" above. "1 to 2 miles" is a common language construct in the English language. I think it's common in other languages but the word would vary and maybe the whole expression.
- Anyway thanks, I'm looking forward to using this. Simishag (talk) 09:37, 14 February 2008 (UTC)
- Cool! I'd offer to help but I'm not sure I understand the template system. I do have some suggestions for functionality:
- I generally recommend the use of a word (e.g. 'to') in unit ranges because a short line (hyphen, short dash, long dash) looks similar to a minus sign. Lightmouse (talk) 10:37, 14 February 2008 (UTC)
Another set of templates that duplicate the functions of this one
There is another large set of templates that duplicate the functions of this one. Have a look at: Template:1ft3in and all the others in 'Category:Rail transport gauge templates'. Lightmouse (talk) 11:15, 14 February 2008 (UTC)
- With the exception of the few that use fractions, most of those are redundant and over specialized. —MJCdetroit (yak) 17:17, 14 February 2008 (UTC)
- I agree. They predate this template so the intention is understandable. I see no reason why they should not be replaced by this one. The only issue is to ensure that the format is correct. For example, I believe that metric rail gauges are usually expressed in mm with no commas. It is easy enough to check the rail templates to see what formats they use and simply adjust the convert template as required. Lightmouse (talk) 11:35, 15 February 2008 (UTC)
Smoot?
Could the smoot length unit be included in this template? - Denimadept (talk) 18:47, 14 February 2008 (UTC)
- You must be from Boston... —MJCdetroit (yak) 18:57, 14 February 2008 (UTC)
- How'd you guess? - Denimadept (talk) 19:04, 14 February 2008 (UTC)
- Of course. Jɪmp 03:42, 15 February 2008 (UTC)
- How'd you guess? - Denimadept (talk) 19:04, 14 February 2008 (UTC)
Kilometres per second
Can a template be provided for km/s? Lightmouse (talk) 14:39, 15 February 2008 (UTC)
- Done. I've added mi/s too. Jɪmp 18:24, 18 February 2008 (UTC)
Why aren't there by default 2 decimals in meters?
The default in meters should be {{convert|...|m|2}}
. Anything else is (or at least should be) an exception. -62.219.97.68 (talk)
- Why do you say that? Number of decimal places depends on the figures involved and their magnitude. Whoever uses the template should decide how many are appropriate. - Denimadept (talk) 18:40, 15 February 2008 (UTC)
- The default is to round to a similar precision as the input. Jɪmp 18:27, 18 February 2008 (UTC)
- Sorry to everyone, I forgot to mention I meant specifically to height. Re-read my statement now:
- The default for US height (which is supposed to have no digits) should be
{{convert|...|m|2}}
(height in meters is supposed to have 2 digits) - But I guess you have no way to know if the editor wants height or something else, right? -62.219.107.102 (talk) 17:23, 19 February 2008 (UTC)
- That's a strange one to me. As I understand it, the editor selects, as I said before and Jimp said as well, that it depends on the figures involved. Have you not taken science in high school or college? - Denimadept (talk) 17:36, 19 February 2008 (UTC)
- I see no reason for you to break Wikipedia's rules by being unable to converse like a normal person. Anyway, if someone is X"Y', in meters they'd be Z.AB and vice versa.
- For example,
{{convert|5|ft|6|in|m}}
is 5 feet 6 inches (1.68 m) when it really should be 5 feet 6 inches (1.68 m) - -62.219.107.102 (talk) 09:04, 20 February 2008 (UTC)
- Not sure where that came from. If a figure is X ft, it's generally Y meters, depending on how many significant figures in X. Let's go into more detail to clear this up. If I have a figure 1234 ft, and do a conversion to meters, I'll get 376.1232 meters. In order to keep the four digits of precision I started with, I'll need to specify 1 decimal place. If I convert to centimeters, I'll get 37612.32 cm. In order to keep the proper digits of precision, I need to keep zero decimal places, and I'll still have more than I really should have. Understand? You only get to keep the number of digits of precision you started with. You can't expect a hard rule of "two decimal places for a meter" to make sense, so it's not in the template. You're expected to understand your figures, the number of digits of precision you started with, and how to get the template to display only the reasonable number of digits given your initial precision. If I'd started with a figure of 1234.0, I'd have 5 digits of precision, so I could display a total of 5 digits in my results. As I started with 4 digits, I only really can use 4 digits in the result. - Denimadept (talk) 14:31, 20 February 2008 (UTC)
- Or, if you don't believe me, see Significant figures - Denimadept (talk) 15:36, 20 February 2008 (UTC)
- The template is not designed specifically for people's heights but is a general purpose template. In many cases rounding to the nearest centimetre would be undesirable, conversions of mountain heights in feet, for example. Specification to the nearest centimetre involves a greater degree of precision than specification to the nearest inch. The default rounding does allow for some degree of increase in apparent precision but not this much. If you want two decimal places, you can specify this, but if you must have this as the template's default, there's always {{height}}. Jɪmp 01:58, 21 February 2008 (UTC)
Acres
In the template output, input of "acre" is output only as the plural "acres." (No abbreviation is offered.) In some contexts (such as "1000-acre park") the output should be singular. The offer of the abbreviation "ac" would fix this -- can that be done? --Orlady (talk) 15:35, 17 February 2008 (UTC)
- Use the adjective partameter e.g. {{convert|12|acre|ha|adj=on}} results in 12-acre (4.9 ha). TINYMARK 15:51, 17 February 2008 (UTC)
- Thanks! That works. --Orlady (talk) 16:31, 17 February 2008 (UTC)
Decare
Can someone add Decare to the area measures? It's commonly used in Norway, and possibly other European countries as well - corresponds to 1000 sqmeters. Thanks in advance. --Leifern (talk) 15:48, 18 February 2008 (UTC)
- That is very similar the the metric Dunam, which we already have; {{convert|1.0|dunam|sqm sqft|0|lk=on}}--> 1.0 dunam (1,000 m2; 10,764 sq ft). It should be just a matter of duplicating the dunam sub templates and switching the names. —MJCdetroit (yak) 16:06, 18 February 2008 (UTC)
- Done. The default "convert to" is square kilometers and square miles. —MJCdetroit (yak) 16:25, 18 February 2008 (UTC)
- Thanks! --Leifern (talk) 16:38, 18 February 2008 (UTC)
- The code
daa
(the unit's standard abbr) can also be used. Jɪmp 18:24, 18 February 2008 (UTC)
- The code
Wondering about cases
Would it be easy and acceptable to add a "cases" to "liters" routine into the mix? Just wondering, certainly no grave matter but would help a dilemma with wine and winery-related articles. I have no experience with this, but it seems it should be staightforward to plug a digit for "cases" then convert x12 x 0.75 for a liter value.. and eh.. the opposite..? Is this a possibility? MURGH disc. 21:16, 18 February 2008 (UTC)
- I am sure it is possible. However, initially, I'd have to say that we shouldn't because the definition varies by location. I thought that you were talking about beer until I read the second line. In my part of the world, a "case" almost always refers to beer; one case = 24 x 12 US fl oz. Also, in the wine world, is that a case of fifths (750 mL) or magnums (bigger but not sure how much, don't do much wine drinking)? Also, most wine bottles that I remember seeing are labeled in milliliters (mL) not liters (L). —MJCdetroit (yak) 21:34, 18 February 2008 (UTC)
- Yes you're right, 750 mL is a common bottle declaration, but when winery is defined in annual activity by 550,000 bottles or 80,000 cases, being able to relate it in terms of hectolitres or gallons could have some encyclopedic value. But yes, the initial "case" in question here is a very French affair, but couldn't this be specified? MURGH disc. 21:54, 18 February 2008 (UTC)
- It could be done. One case would be 12 × 750 ml, i.e. 0.009 m³. It wouldn't work for American beer nor would it work for Canadian or Japanese beer but it would work for Australian beer since Aussie beer cans are bigger (375 ml, still two dozen a case). Jɪmp 00:29, 19 February 2008 (UTC)
- I'm pretty sure the "wine case" and 750 mL wine bottle standards are consistent with the continental Europe, US, South American, Australian and South African wine industries/markets. Liters and gallons on the other hand. so.. 0.009 cum[convert: unknown unit], so a wine case is 9 liters, 9 L (2.4 US gal).. cool. (unless I screwed up the math?) Yes, this would be a nice function for winery infoboxes and such. How do I most wisely petition for this? MURGH disc. 03:10, 19 February 2008 (UTC)
- Just so there isn't any confusion, I think that we shouldn't use "case" by itself. It should be "winecase" (or something).
- I'm pretty sure the "wine case" and 750 mL wine bottle standards are consistent with the continental Europe, US, South American, Australian and South African wine industries/markets. Liters and gallons on the other hand. so.. 0.009 cum[convert: unknown unit], so a wine case is 9 liters, 9 L (2.4 US gal).. cool. (unless I screwed up the math?) Yes, this would be a nice function for winery infoboxes and such. How do I most wisely petition for this? MURGH disc. 03:10, 19 February 2008 (UTC)
- On a side note to Jimp: in the U.S. a case of beer is 24 x 12 US fl oz (355 mL), both cans and bottles. However, in Canada (at least in Ontario and Quebec), they're not referred to as "a cases of beer", they're referred to as a "Two-Fours of beer" in which cans are sized in U.S. fl oz: 12 fl oz (355 mL) and bottles are sized in imperial fluid ounces: 12 imp fl oz (341 mL). So you can see why we shouldn't use "case" by itself. [2]. —MJCdetroit (yak) 04:26, 19 February 2008 (UTC)
- You most wisely petition the way you are. I don't recall hearing two-four of beer when I was in Canada but I was on the other side ... and mostly bought six-packs. Is it 12 fl oz (355 ml) or is it 355 ml (12 fl oz) in the US ... i.e. what's the definition. I believe it's plain 355 ml for a can in Canada without mention of US fl oz (except on imports). No, just case by itself may lead to strife ... at least in the coding but would not context (and the conversion) dispell the ambiguity when it comes to what the template displays? That is if we're talking about US beer then we shouldn't need the likes of case (US beer) displayed in the article ... or am I stating the obvious. Jɪmp 08:45, 19 February 2008 (UTC)
- But how does the US (or Canadian) beer industry measure volume performance by year? Is case such a widely used term (I've never gone beyond "a couple of six-packs". I've heard of "crates of beer"..) For Euro wine, it's a constant annual production term for wineries (except those offering bottle numbers which one can of course divide by 12), and then regions will declare estimations of hL. It would be great to have a tool that could translate figures between these. MURGH disc. 12:32, 21 February 2008 (UTC)
- The hectolitre may well be used by specialists but it is by no means universal in the industry. We should remember that an encyclopedia for all (i.e. Wikipedia) can be informed by, but is not bound by what specialists do. However I have no objection to the conversion option being available. Lightmouse (talk) 21:44, 21 February 2008 (UTC)
- Of course, the template already does hectolitres should the need arise for such a unit. I'm adding
winecase
defined as nine litres. Other cases can be added later if needed. Jɪmp 14:37, 27 February 2008 (UTC) ... Done, the code iswinecase
, it displays case (no abbreviation) linking to Case (goods) & conversion is to litres by default. Jɪmp 14:47, 27 February 2008 (UTC)
- Of course, the template already does hectolitres should the need arise for such a unit. I'm adding
Use of singular/plural
Is there a way to select if units are described as singular or plural? I'd like the first sentence of Las Vegas Strip to say "a 4 mile (6.4 km) road". However, if I use {{convert|4|mi|km}}, I get "a 4 miles (6.4 km) road". Simishag (talk) 06:09, 19 February 2008 (UTC)
- Use
{{convert|4|mi|km|adj=on}}
. Jɪmp 08:33, 19 February 2008 (UTC)
Messages
I suggest include examples of conversion in the unit articles, specially when talking about the concrete unit conversion
For this, is better include customizable messages:
- 1 psi is 6.894757 kPa: we could use {{convert|message|1|psi|is|kPa|6|abbr=on|lk=on}}.
- 1 psi ≈ 6.894757 kPa: we could use {{convert|message|1|psi||kPa|6|abbr=on|lk=on}}.
If the parameter "message" or "mess" is employed, the user must include the message to show (in these cases is' or ≈). --Nopetro 08:14, 21 February 2008 (UTC)
- If we're going to do this, it'll best be done with the existant
disp
parameter. Something like this.
- 1 psi is 6.894757 kPa: we could use {{convert|1|psi|kPa|6|disp=mess/is|abbr=on|lk=on}}.
- 1 psi ≈ 6.894757 kPa: we could use {{convert|1|psi|kPa|6|disp=mess/approx|abbr=on|lk=on}}.
- or just
- 1 psi is 6.894757 kPa: we could use {{convert|1|psi|kPa|6|disp=is|abbr=on|lk=on}}.
- 1 psi ≈ 6.894757 kPa: we could use {{convert|1|psi|kPa|6|disp=approx|abbr=on|lk=on}}.
Good. If you want, we can include disp= it in the template and in the documentation. Thank you --Nopetro 09:01, 21 February 2008 (UTC) —Preceding unsigned comment added by Nopetro (talk • contribs)
- Don't thank me yet, it'll take a few dozen subtemplates to get the thing up & running. Jɪmp 03:07, 25 February 2008 (UTC)
Weight conversions
There seems to be a problem with weight conversions:
{{convert|{{{weight_lbs|{{{weight_lb|200}}}}}}|lb|kg stlb|lk=on|abbr=on}} —> 200 lb (91 kg; 14 st 4 lb)
Which works here and on the sandbox, but it doesn't work here or when used in Template:Infobox Ice Hockey Player (see Theoren Fleury for an example). --JD554 (talk) 09:52, 21 February 2008 (UTC)
- Just to add a bit more information: the problem only happens in Firefox not when using IE (not sure about other browsers). --JD554 (talk) 13:01, 21 February 2008 (UTC)
- 200 lb (91 kg; 14 st 4 lb)
- 200 lb (91 kg)
- I changed the Template:Infobox Ice Hockey Player to just kg, so that should help. However, the main {{convert}} code hasn't changed since December 12th, 2007 and the sub template {{Convert/kg stlb}} hasn't been changed since January 12th. The subtemplate {{Convert/lb}} was placed under protection yesterday (Feb 21) but that doesn't change anything about the code itself. So the question remains: where is that extra space after the number and before the kg coming from? AND why only in FF? We'll try to figure it out. —MJCdetroit (yak) 15:01, 21 February 2008 (UTC)
- It happens in IE7 (for WinXP)—MJCdetroit (yak) 16:12, 21 February 2008 (UTC)
- I fixed it, somebody had added a newline to some templates, e.g. [3].--Patrick (talk) 17:52, 21 February 2008 (UTC)
- The rnd templates shows: Expression error: Unrecognised punctuation character "{" are these used somewhere... --— Typ932T | C 18:04, 21 February 2008 (UTC)
- That is the "result" in the case of undefined parameters. I have put includeonly tags now, to avoid the impression that something is wrong.
- The rnd templates shows: Expression error: Unrecognised punctuation character "{" are these used somewhere... --— Typ932T | C 18:04, 21 February 2008 (UTC)
- I fixed it, somebody had added a newline to some templates, e.g. [3].--Patrick (talk) 17:52, 21 February 2008 (UTC)
Request
Could the verst and square verst please be added as a unit of length/area conversion option? The output should be both kilometers/square kilometers and miles/square miles. Thanks!—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); 18:32, 21 February 2008 (UTC)
- Done: codes are
verst
andsqverst
(long-handsquare verst
also works). Jɪmp 03:31, 22 February 2008 (UTC)- Thanks, but could you make it convert to both kilometers and miles on the same call? {{Convert|100|verst|km}} produces "100 versts (110 km)", but "100 versts (110 km/66 mi) would be more helpful. Is that doable?—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); 14:50, 22 February 2008 (UTC)
- Use
km mi
&km2 mi2
e.g. {{Convert|100|verst|km mi}} produces "100 versts (110 km; 66 mi)" and {{Convert|100|sqverst|km2 mi2}} produces "100 square versts (110 km2; 44 sq mi)" ... or, in this case, just leave it blank (it's the default for (sq)verst) i.e. {{Convert|100|verst}} produces "100 versts (110 km; 66 mi)" and {{Convert|100|sqverst}} produces "100 square versts (110 km2; 44 sq mi)". Jɪmp 16:53, 22 February 2008 (UTC)- P.S. just added
verst2
for square verst. Jɪmp 17:03, 22 February 2008 (UTC)- Ah, must have missed that feature. Thanks again!—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); 18:06, 22 February 2008 (UTC)
- P.S. just added
- Use
- Thanks, but could you make it convert to both kilometers and miles on the same call? {{Convert|100|verst|km}} produces "100 versts (110 km)", but "100 versts (110 km/66 mi) would be more helpful. Is that doable?—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); 14:50, 22 February 2008 (UTC)
Are you kidding?
Judging by the code for this template, Mediawiki has created a language to rival Brainfuck for utter impenetrability. Kudos to the authors of this template for managing to stay sane and get it working. --P3d0 (talk) 16:22, 22 February 2008 (UTC)
Temperature of 0.1 or -0.1 fails to convert
{{convert | -0.1 | C | F | sigfig=1 }} produces
−0.1 °C (0 °F) which is incorrect. Nicholas Perkins (T•C) 17:23, 24 February 2008 (UTC)
- What is the correct answer, then? Seems a pretty straight-forward question at first glance but round 273.05 K to one sig-fig and you get 300 K, i.e. precision to the nearest hundred kelvins. Does it make sense then to say that -0.1 °C is precise to one significant figure ... what about the 273 K which are hidden from view? To me it really makes no sense to talk about significant figures in scales which don't start at zero. What the template is doing therefore is rounding the conversion to Fahrenheit to a degree of precision equivalent to that of the temperature in Kelvin rounded to one significant figure. No template error here, "I just wrote it like that". Of course, if we'd all be more happy pretending (I mean no offense) that −0.1 °C converted to Fahrenheit and rounded to one significant figure is 30 °F, things could be changed. However, I'd rather have the template return an error message and put a warning on the doc page not to try sigfig with Fahrenheit or Celcius. Jɪmp 03:02, 25 February 2008 (UTC)
- Maybe he wanted "1", as in rounding precision of "1", and not "sigfig=1". In other words,
- {{convert|-0.1|C|F|1 }} --> −0.1 °C (31.8 °F)
- Just a thought, but a small warning on the doc page about this sigfig °C/°F maybe warranted. —MJCdetroit (yak) 03:13, 25 February 2008 (UTC)
- Done.--Patrick (talk) 10:25, 25 February 2008 (UTC)
- That's exactly what I was after. Thanks for the help and sorry for the inconvenience. Nicholas Perkins (T•C) 09:50, 25 February 2008 (UTC)
- Just a thought, but a small warning on the doc page about this sigfig °C/°F maybe warranted. —MJCdetroit (yak) 03:13, 25 February 2008 (UTC)
Code deprecation
I've depreciated kph
in favour of km/h
, try it now and you'll get "The code kph
is depreciated. Use km/h
instead.". In time the subtemplate should be deleted. I'd like to do the same with a few others but some are still quite widely used e.g. km:h
. One, however, does stick out in particular. kt
is currently an alternative abbreviation for knots, however, in standard metric abbreviation "kt" stands for "kilotonne". I keep changing the transclusions using it to kn
but they keep on coming. It's getting time to kill this one off. Jɪmp 01:46, 27 February 2008 (UTC)
- I'm about to put similar messages on {{convert/m:s}} and {{convert/ft:s}}. I've also put the following up for deletion.
- Template:Convert/mph kph (edit | talk | history | links | watch | logs)
- Template:Convert/mph km:h (edit | talk | history | links | watch | logs)
- Template:Convert/mi:h km:h (edit | talk | history | links | watch | logs)
- Template:Convert/mi/h km/h (edit | talk | history | links | watch | logs)
- Template:Convert/m:s ft:s (edit | talk | history | links | watch | logs)
- Template:Convert/km/h mi/h (edit | talk | history | links | watch | logs)
- Template:Convert/kph mph (edit | talk | history | links | watch | logs)
- Template:Convert/km:h mph (edit | talk | history | links | watch | logs)
- Template:Convert/km:h mi:h (edit | talk | history | links | watch | logs)
- Template:Convert/ft:s m:s (edit | talk | history | links | watch | logs)
- Template:Convert/foot:s (edit | talk | history | links | watch | logs)
- Jɪmp 06:39, 27 February 2008 (UTC)
- Excellent! Incidentally, The SI authority acknowledges the absence of a standard unit for knot but it uses 'kn'. See: Table 8. Other non-SI units.
- I am delighted that you are now deprecating these templates. I have corrected many of the unwanted formats (kph, kmph, km/hr, kt, kts, km:h, mi:h, etc). My script does this automatically if it comes across them. If anyone wants the script or AWB regex for such things, just let me know. Some of these are ideal bot fodder. Lightmouse (talk) 10:37, 28 February 2008 (UTC)
Square brackets for quotes?
What do people think about an option for square brackets for use in quotes? This appears to be a convention. Lightmouse (talk) 10:43, 28 February 2008 (UTC)
- It wouldn't be hard to do ... laborious, but not hard. What code will we use unlike
disp=/
for slashes we can't use actual square brackects it won't work. How aboutdisp=sqbr
? Jɪmp 23:57, 28 February 2008 (UTC)
Support for bbl, long ton
I consider myself fairly handy with templates, but as someone noted above, these seem pretty hairy...
Could someone provide support for these two units:
- oil barrels (1 bbl = 158.987 3 L), and
- the Long ton (1 long ton = 1016.0469088 kg)?
These units are widely used in articles about ships and the shipping industry.
Thanks! HausTalk 22:51, 28 February 2008 (UTC)
- The code for the oil barrel is
oilbbl
. The conversion factor it uses is 1 bbl ≡ 0.158987294928 m³ (42 US gal).
- The codes for the long ton are
LT
andL/T
these corespond to the abbreviations the template will output, use whichever you prefer ... of course, if you're spelling it out it makes no difference which you use. I'm thinking of adding code to force the unit to be spelt out in case editors don't feel that either "LT" or "L/T" are well enough recognised. It might also be good to be able to drop the "long" for contexts (e.g. shipping) where this is the only ton used (not counting the tonne i.e. "metric ton"). Same story for the short ones.
- Jɪmp 23:48, 28 February 2008 (UTC)
- I believe that dropping the long would going against the MOSNUM as it asks to differentiate between long and short tons in the same manner as imperial and U.S. gallon. It's probably best to leave it in. I do like the idea of having long/short ton spelled out in the parenthesis, i.e. 1,510 metric tons (1,664 short tons). I'm —MJCdetroit (yak) and I approved this message 00:27, 29 February 2008 (UTC)
- That's pretty much my feeling too but I do feel like a bit of an intruder when I insert a long into ship infoboxes I edit when none of them make the distinction ... on the other hand, they probably should: how's your average Joe Blow to know that they don't use short tons for ships even in the US? Jɪmp 01:42, 29 February 2008 (UTC)
- Wow, thanks for jumping on that so quickl! TYour discussion brings us to the next item I had on my list: a template for deadweight tons. What I was thinking about was something like
{{dwt|30,000|long}}
to give 30,000 [[deadweight tons]] (DWT) (xxx deadweight tonnes). and{{dwt|30,000|brief}}
to give 30,000 DWT (xxx deadweight tonnes). Any feelings? Cheers, HausTalk 02:07, 29 February 2008 (UTC)- Deadweight tonnes/tons could be added to {{convert}} without too much trouble. Note that [[deadweight ton]] is a redirect to Tonnage so we'd by-pass that. The template normally outputs either the full name of the unit or its abbreviation the rules by which this is done are pretty straight-forward (except when
disp=table
):- For units without abbreviations the unit is always spelt out.
- Otherwise units are always abbreviated when in brackets.
- Other-otherwise units are spelt out unless
abbr=on
.
- Note, however, that I had been discussing having forced spelling out of long ton and short ton where there exists abbreviations. What I've got in mind here is a new code which will make the template behave as if there is no abbreviation. The same could be done in order to get your full "deadweight tons (DWT)" form, however, the way the template is set up (without doing a ton of work) the linking will be like this [[tonnage|deadweight tons (DWT)]] (i.e. the "DWT" will be included). So am I right to assume that a deadweight ton is basically a long ton worth of deadweight (and similarly for a deadweight tonne)? Am I right in reading you that DWT stands (exclusively) for deadweight tons (not deadweight tonnes)? Is there an abbreviation for deadweight tonnes? What I've got in mind is the following coding:
- Deadweight tonnes/tons could be added to {{convert}} without too much trouble. Note that [[deadweight ton]] is a redirect to Tonnage so we'd by-pass that. The template normally outputs either the full name of the unit or its abbreviation the rules by which this is done are pretty straight-forward (except when
- Wow, thanks for jumping on that so quickl! TYour discussion brings us to the next item I had on my list: a template for deadweight tons. What I was thinking about was something like
- That's pretty much my feeling too but I do feel like a bit of an intruder when I insert a long into ship infoboxes I edit when none of them make the distinction ... on the other hand, they probably should: how's your average Joe Blow to know that they don't use short tons for ships even in the US? Jɪmp 01:42, 29 February 2008 (UTC)
- I believe that dropping the long would going against the MOSNUM as it asks to differentiate between long and short tons in the same manner as imperial and U.S. gallon. It's probably best to leave it in. I do like the idea of having long/short ton spelled out in the parenthesis, i.e. 1,510 metric tons (1,664 short tons). I'm —MJCdetroit (yak) and I approved this message 00:27, 29 February 2008 (UTC)
DWT
for "deadweight tons" or "DWT": switch between abbreviations & spelt-out forms in the usual way DWT-full
for "deadweight tons (DWT)": the full version (I'm not too keen on calling it "long" for fear of confusion with long verses short tons.) DWtonne
for "deadweight tonnes"
- Would that make sense? Jɪmp 03:23, 29 February 2008 (UTC) ... P.S. Be careful not to get DWT confused with dwt or we'll be out by a factor of 653,333⅓. Jɪmp 03:29, 29 February 2008 (UTC) P.P.S. Codes
long ton
,short ton
&metric ton
now force the units names to be spelt out. Jɪmp 03:39, 29 February 2008 (UTC)- Your approach looks great to me. Some answers:
- 1. In the U.S. a DWT is always a long ton of deadweight.
- 2. I've found examples outside the U.S. (at Det Norske Veritas) of a DWT being a long ton of deadweight.
- 3. I've found examples outside the U.S. of a DWT being a deadweight tonne.
- I think the only way of avoiding confusion is picking a Wikipedia standard and using it.
- Hope that helps. HausTalk 04:59, 29 February 2008 (UTC)
- Would that make sense? Jɪmp 03:23, 29 February 2008 (UTC) ... P.S. Be careful not to get DWT confused with dwt or we'll be out by a factor of 653,333⅓. Jɪmp 03:29, 29 February 2008 (UTC) P.P.S. Codes
- Of course, picking a Wikipedia standard and using it might not be as simple as it sounds. One bunch of editors may pick one and use it, the next bunch might follow suit, another bunch might deliberately ignor the choice, the next bunch might never have read that there was ever a choice made in the first place. What about the readers? How's the average reader to know that we'd made a decision that "DWT" will always stand for this or for that?
- I did a bit of a Google and found that it is a bit of a mixed bag. Most of the "DWT"s I ran across were long but there were a fair number of metric ones about. Russ Rowlett's Dictionary of Units of Measurement had this to say.
deadweight ton (dwt)
a traditional unit of weight or mass used in the shipping industry. The deadweight tonnage of a ship is the difference between its weight when completely empty and its weight when fully loaded. This includes the weight of everything portable carried by the ship: the cargo, fuel, supplies, crew, and passengers. The deadweight ton is traditionally equal to the British ("long") ton of 2240 pounds (1016.047 kilograms). However, more and more often it is being taken to equal the metric ton (exactly 1000 kilograms, or 2204.623 pounds).
- If we settle on having "DWT" stand for "deadweight long ton", might we not fall behind the times ... eventually? Another way of avoiding the confusion may be to always spell the units out or to add dsiambiguation to the abbreviation e.g. "DWT (metric)" vs "DWT (long)" "DWTmetric" vs "DWTlong"
←outdent← On the other hand, if a Wikipedia standard is chosen, the template will follow the choice. However, any such decision will, of course, need discussion on a more general forum than this talk page. It'd have to be discussed at WT:MOSNUM and the relavant project talk page (I'm sure you, Haus, have a better idea than I of where that might be). In the meantime, these two new codes which I've introduced might be useful.
DWtonne
, as mentioned above:- defined as 1000 kg (one tonne),
- the unit is always spelt out deadweight tonne,
- when you turn linking on the unit name links to Tonnage,
- the default conversion is to
DWton
DWton
, similarly:- defined as 1016.0469088 kg (one long ton),
- the unit is always spelt out deadweight ton,
- when you turn linking on the unit name links to Tonnage,
- the default conversion is to
DWtonne
Note that as these both link to the same article it might be best to use lk=in
to link only the first (the input).Jɪmp 02:25, 3 March 2008 (UTC) (P.S. By the way if you want to use the codes I mentioned above to force long/short/metric ton to be spelt out, don't use the plural, use e.g. {{convert|100|long ton|0}}
.) Jɪmp 02:39, 3 March 2008 (UTC)
- As you seem to be something of a mover and shaker at WT:MOSNUM, can I suggest you kick the discussion off and I'll pitch in as seems fit? I'll then mention the thread at WT:MTD and WT:SHIPS to see if we can get any SME input. Cheers. HausTalk 02:55, 3 March 2008 (UTC)
- I haven't been moving much over there of late & I dunno how much I shake. I can give it a whirl but I've gotta say that my preference would be to avoid plain "DWT" in favour of "DWT (metric)" vs "DWT (long)" to avoid confusion (esp. to make it clear for non-shipping-buffs that don't realise that a ton at sea is never short). The subscripts, whilst nice & compact, might be a little to close to our own invented abrreviations. Jɪmp 03:24, 3 March 2008 (UTC)
- I like the subscripts. —MJCdetroit (yak) 14:11, 3 March 2008 (UTC)
- Me too, æsthetically speaking. My fear, however, is that it could be argued that a subscript is part of the symbol therefore "DWTmetric" & "DWTlong" could be seen as being symbols of our own invention. Shall we take it to MOSNUM? Jɪmp 23:46, 3 March 2008 (UTC)
- Let's continue @ WT:MOSNUM#DWT. Jɪmp 06:13, 4 March 2008 (UTC)
- Me too, æsthetically speaking. My fear, however, is that it could be argued that a subscript is part of the symbol therefore "DWTmetric" & "DWTlong" could be seen as being symbols of our own invention. Shall we take it to MOSNUM? Jɪmp 23:46, 3 March 2008 (UTC)
- I like the subscripts. —MJCdetroit (yak) 14:11, 3 March 2008 (UTC)
- I haven't been moving much over there of late & I dunno how much I shake. I can give it a whirl but I've gotta say that my preference would be to avoid plain "DWT" in favour of "DWT (metric)" vs "DWT (long)" to avoid confusion (esp. to make it clear for non-shipping-buffs that don't realise that a ton at sea is never short). The subscripts, whilst nice & compact, might be a little to close to our own invented abrreviations. Jɪmp 03:24, 3 March 2008 (UTC)
Changing the defualt conversion for foot-pounds force
Until now the default conversion for foot-pounds (force) (codes ftlb
, ftlb-f
& ftlbf
) had been to joules. I noticed that the subtemplates involved were mainly used on automotive articles where torque is almost certainly what is meant.
- Template:Convert/ftlb (edit | talk | history | links | watch | logs)
- Template:Convert/ftlb-f (edit | talk | history | links | watch | logs)
- Template:Convert/ftlbf (edit | talk | history | links | watch | logs)
I've changed the default to newton-metres in line with that of pound (force)-feet. Now we don't have to remember which way that old-standing convention that never was consistantly applied went. Jɪmp 01:58, 5 March 2008 (UTC)
- Okay, a lot of gun articles also transclude {{convert/ftlbf}} and in this case it's joules which are intended. I've fixed .700 Nitro Express which was relying on the default to joules. I don't see any other main-space transclusions which rely on default conversion. Jɪmp 03:42, 5 March 2008 (UTC)
- I've done the same to the inch-pound force and inch-ounce force subtemplates. Jɪmp 03:51, 5 March 2008 (UTC)
Context and liquid/dry units
Is there a way to, for example, make fluid ounces show up as only "oz" in the output of the template, where it's clear from context what is meant? —Random832 15:34, 7 March 2008 (UTC)
- Not at the moment but it wouldn't be too hard to do. Jɪmp 15:45, 7 March 2008 (UTC)
- Use
(impfl)oz
or(usfl)oz
. Jɪmp 15:54, 7 March 2008 (UTC)
- Use
textual version
I think it'd be nice to have a parameter to choose viewing the values in text format (like {{numtext}} does). a parameter like text=on
could be used, what do you think? --Waldir talk 14:21, 9 March 2008 (UTC)
Hear, hear. Fully agree. Would help with MoS for numbers (in words if number can be represented in one word, including hyphens). How about the ability to select input value, output value or both in words? Suggest a parameter name of wrd? wrd=in, wrd=out, wrd=on