Template talk:Convert
This article was the Collaboration of the month for June 2020. |
Experimental
[edit]This has been sitting here as experimental for almost 3 months now. It is currently used at EuroVelo cycling routes. Is this something useful enough to keep and unleash for use in other articles? Texugo (talk) 17:29, 15 April 2014 (UTC)
- It needs documentation (see w:Template:Convert), but I'd support this template as it seems like a useful shortcut for ensuring that units are properly displayed with both imperial and metric units. -- Ryan • (talk) • 19:39, 15 April 2014 (UTC)
- I'd be afraid it's too complicated for us to maintain. Someone would have to be dedicated to monitoring the English Wikipedia version for changes and importing them -- and if any of those changes wreck backward compatibility... is it that hard to manually include the conversions? We don't have long tables of figures that need conversions like Wikipedia often does. Powers (talk) 20:04, 16 July 2014 (UTC)
- I'm in favor of this template. Converting measurements myself may not be a horribly onerous burden, but I appreciate having the option of just plugging the number into a template and having the server convert it for me, allowing me to focus a little more on editing. This primarily benefits editors, but it clearly (though indirectly) benefits travelers by making the task of writing a travel guide (complete with needed conversions) a little easier.
- I'll admit, before I stumbled upon this discussion, I assumed this was a template available for use just like any other. I just tried out
{{convert}}
while editing an article recently and discovered it worked just like its English Wikipedia counterpart, so I ran with it. — Athelwulf [T]/[C] 05:57, 5 September 2014 (UTC)
- It's always seemed to me that the trouble of looking up the syntax for the template was comparable to the trouble of plugging some numbers into Google. Powers (talk) 23:27, 5 September 2014 (UTC)
- It's also a heavy template with lots of units we'll never need. We have no reason to convert nanojoules or terawatt-hours or milli-calories or hectopascals or bushels or angstroms or really 95% of the things this template does. Taking Powers' comment about syntax, if we're going to template these things, I'd rather have four separate templates for the only four conversions we really need, maybe {{F-C}}, {{C-K}}, {{M-Km}}, and {{Km-M}}, with the simple syntax of only putting in the first unit. Texugo (talk) 23:59, 5 September 2014 (UTC)
- It's always seemed to me that the trouble of looking up the syntax for the template was comparable to the trouble of plugging some numbers into Google. Powers (talk) 23:27, 5 September 2014 (UTC)
- I'm more familiar with the template than most, and know exactly what to type (for common units anyway) without having to look up the documentation, so I guess that's why I find it easier to use than opening a new tab and asking Google. But yeah, the template does do way too much. Streamlining is a good idea. Not really convinced that multiple templates for the same basic task are easier to manage than a single template that needs more inputs. — Athelwulf [T]/[C] 03:23, 6 September 2014 (UTC)
- In theory we could establish Texugo's suggested templates (I'd also suggest feet and meters) as wrapper templates for {{convert}}, letting convert do all the work while keeping the syntax simple. But we'd still have the problem of maintenance. Module:Convert is where all the code is; is anyone here familiar with Lua? The module was imported in January; Wikipedia's version has had three updates since then. How disparate do we let them get? Powers (talk) 13:26, 6 September 2014 (UTC)
- Convert is extremely useful in keeping conversions correct and consistent. It manages result precision to match the source precision in addition to using correct and consistent formulas. I would suggest Texugo's {{M-Km}}, and {{Km-M}} should be {{Mi-Km}}, and {{Km-Mi}}, assuming the conversion was Miles instead Meters. I believe the needs are far more than four or six. Millimeters to inches is needed for precipitation; meters to feet for elevation; acres or square miles to hectares or square meters. Once you've used it a few times the more common usages are easy to remember. Many of the optional parameters are not needed very often. Measurement conversions will be non-existent or questionable until an automatic facility like this exists. Maintenance does need careful attention to be sure Convert code dependencies are carefully maintained here.
SBaker43 (talk) 01:53, 31 October 2014 (UTC)- Conversions only really become essential to have when we're talking about getting an article up to star-quality, at which point it's maybe a 10-minute task for an editor to put them in. Powers (talk) 13:28, 31 October 2014 (UTC)
- Convert is extremely useful in keeping conversions correct and consistent. It manages result precision to match the source precision in addition to using correct and consistent formulas. I would suggest Texugo's {{M-Km}}, and {{Km-M}} should be {{Mi-Km}}, and {{Km-Mi}}, assuming the conversion was Miles instead Meters. I believe the needs are far more than four or six. Millimeters to inches is needed for precipitation; meters to feet for elevation; acres or square miles to hectares or square meters. Once you've used it a few times the more common usages are easy to remember. Many of the optional parameters are not needed very often. Measurement conversions will be non-existent or questionable until an automatic facility like this exists. Maintenance does need careful attention to be sure Convert code dependencies are carefully maintained here.
- In theory we could establish Texugo's suggested templates (I'd also suggest feet and meters) as wrapper templates for {{convert}}, letting convert do all the work while keeping the syntax simple. But we'd still have the problem of maintenance. Module:Convert is where all the code is; is anyone here familiar with Lua? The module was imported in January; Wikipedia's version has had three updates since then. How disparate do we let them get? Powers (talk) 13:26, 6 September 2014 (UTC)
- I've deleted & re-imported this template to ensure that we're giving proper credit. I've also pulled in documentation, and from what I've read in that documentation I don't see any harm in keeping this as-is. Regarding the point that we only need conversions for star articles, even if we just use it for star articles it's functionality that we would use, and people have already started using it even for non-star articles. Regarding the point that conversions can be done manually, that is likely to be more error-prone, and use of a template reduces the amount of data entry required. Finally, regarding the point that we could have separate templates to avoid the necessity of adding the "convert to" and "convert from" units, even if we did so, wouldn't it be better to have those templates call a common base template rather than implementing conversions separately for each of the new templates? -- Ryan • (talk) • 18:17, 14 December 2014 (UTC)
- Yes, I suggested implementing them as wrapper templates above, in September. I still have concerns about readability of the template code within the wikitext. Will a novice user understand the template code well enough to make changes if necessary? I don't see manually writing out conversions to be particularly error-prone -- a typo is just as likely whether one is typing numbers into a template or typing them into Google and copying the result. Powers (talk) 19:05, 14 December 2014 (UTC)
Still experimental?
[edit]I've just rediscovered this template after reading through a related discussion in the pub. I was surprised to see that this is still marked experimental but is quite widely used. (A quick search turned up it's used in more than 1000 articles). As it seems to work well and is so widely used, can we remove the experimental banner? Drat70 (talk) 03:02, 14 September 2017 (UTC)
- The template does seem to work, but I have concerns about its proliferation. It's been used in places where it's not really appropriate, and I am concerned that it makes our articles harder to edit for users who are unfamiliar with templates and markup. Powers (talk) 21:19, 14 September 2017 (UTC)
Problem with miles-to-kilometers conversion template
[edit]- Swept in from the pub
I'd post this on the talk page for the template, if I could find out where it is (I don't know the name of the template, and it doesn't seem to be indexed at Wikivoyage:Template index:
The plus of this template is that it automatically converts between these two measures of distance. The minus is that it leaves no place for hyphens, which are more often than not needed with these measures (e.g., a 5-mile trail, a 10-km drive). Can anything be done to ameliorate this problem? Leaving hyphens out of adjectives when they're needed is a pet peeve of mine, and if this problem can't be rememdied, I will get rid of these templates wherever they are creating poor grammar. Ikan Kekek (talk) 00:32, 2 November 2019 (UTC)
- Example of the problem here. The article should refer to "5- to 10-mile (8- to 16-km) hikes". Ikan Kekek (talk) 00:34, 2 November 2019 (UTC)
- There's a Template:Convert where the documentation indicates it can handle the above situation. I tried it out on Auyuittuq National Park (on a more simple example) and it works, but not the way I'd like it to -- it prints "kilometre" in full rather than abbreviated, and if I try to force the abbreviation, it won't print the hyphen. I think the template and underlying module probably needs to be tweaked. -Shaundd (talk) 03:20, 2 November 2019 (UTC)
- This could be done but first will need others to also agree to a change to unit formatting so we do not get into reverts of others edits. Once done would be a automatic change of all references to mi or km, or do you what to have user control only for exceptions? --Traveler100 (talk) 06:24, 2 November 2019 (UTC)
- Traveler100, I'm not seeing any contradiction with what's in Wikivoyage:Measurements. And this can't be an automatic change because units are not always used in hyphenated adjectives. There's a difference between "the trail is 5 miles long" and "it's a 5-mile trail". Similarly, "the drive takes 4 hours"; "it's a 4-hour drive". Ikan Kekek (talk) 06:58, 2 November 2019 (UTC)
- Useful grammatical example, I can see it would need to be a parameter option. The other question is related to the fact the convention at present is to use abbreviations (mi, km) not the full word, is that dependent on situation or change all to word? --Traveler100 (talk) 07:03, 2 November 2019 (UTC)
- I see no problem with "a 4-km drive". I'd still hyphenate, but of course that's open to discussion like anything else. Ikan Kekek (talk) 07:21, 2 November 2019 (UTC)
- Quick test looks like have to use word with hyphen, cannot use abbreviation in combination with hyphen. Are other fine with: "the trail is 5 mi (8.0 km) long" and "it's a 5-mile (8.0 km) trail". --Traveler100 (talk) 07:37, 2 November 2019 (UTC)
- Well, that's not so bad. Ikan Kekek (talk) 07:48, 2 November 2019 (UTC)
- @Ikan Kekek:, take a look at the updated documentation for {{mile}}. --Traveler100 (talk) 08:12, 2 November 2019 (UTC)
- I'm OK with this. Thanks for the quick work! Ikan Kekek (talk) 08:18, 2 November 2019 (UTC)
- @Ikan Kekek:, take a look at the updated documentation for {{mile}}. --Traveler100 (talk) 08:12, 2 November 2019 (UTC)
- Well, that's not so bad. Ikan Kekek (talk) 07:48, 2 November 2019 (UTC)
- Quick test looks like have to use word with hyphen, cannot use abbreviation in combination with hyphen. Are other fine with: "the trail is 5 mi (8.0 km) long" and "it's a 5-mile (8.0 km) trail". --Traveler100 (talk) 07:37, 2 November 2019 (UTC)
- I see no problem with "a 4-km drive". I'd still hyphenate, but of course that's open to discussion like anything else. Ikan Kekek (talk) 07:21, 2 November 2019 (UTC)
- Useful grammatical example, I can see it would need to be a parameter option. The other question is related to the fact the convention at present is to use abbreviations (mi, km) not the full word, is that dependent on situation or change all to word? --Traveler100 (talk) 07:03, 2 November 2019 (UTC)
- Traveler100, I'm not seeing any contradiction with what's in Wikivoyage:Measurements. And this can't be an automatic change because units are not always used in hyphenated adjectives. There's a difference between "the trail is 5 miles long" and "it's a 5-mile trail". Similarly, "the drive takes 4 hours"; "it's a 4-hour drive". Ikan Kekek (talk) 06:58, 2 November 2019 (UTC)
- This could be done but first will need others to also agree to a change to unit formatting so we do not get into reverts of others edits. Once done would be a automatic change of all references to mi or km, or do you what to have user control only for exceptions? --Traveler100 (talk) 06:24, 2 November 2019 (UTC)
- There's a Template:Convert where the documentation indicates it can handle the above situation. I tried it out on Auyuittuq National Park (on a more simple example) and it works, but not the way I'd like it to -- it prints "kilometre" in full rather than abbreviated, and if I try to force the abbreviation, it won't print the hyphen. I think the template and underlying module probably needs to be tweaked. -Shaundd (talk) 03:20, 2 November 2019 (UTC)
- {{mile|2}} or {{mi|2} - will show as - 2 mi (3.2 km)
- {{mile|10-15}} or {{mi|10-15} - will show as - 10–15 mi (16–24 km)
- {{mile|2|on}} or {{mi|2|on} or {{mi|2|adj} - will show as - 2-mile (3.2 km)
- will update {{km}} too. --Traveler100 (talk) 09:32, 2 November 2019 (UTC)
- Good! There's no problem with this being announced in the pub (per above); otherwise, I might not have heard about it. --Comment by Selfie City (talk | contributions) 13:36, 2 November 2019 (UTC)
- Again, many thanks for taking this work on and doing it! Ikan Kekek (talk) 16:19, 2 November 2019 (UTC)
- Good! There's no problem with this being announced in the pub (per above); otherwise, I might not have heard about it. --Comment by Selfie City (talk | contributions) 13:36, 2 November 2019 (UTC)
- will update {{km}} too. --Traveler100 (talk) 09:32, 2 November 2019 (UTC)