Template talk:Convert: Difference between revisions
→New Convert/f allows new options: new thread; noted about "disp=flip" with rare options |
|||
Line 96: | Line 96: | ||
:* {{convert/f |10.5|L|usgal|4|x3=exactly}} → {{convert/f |10.5|L|usgal|4|x3=exactly}} |
:* {{convert/f |10.5|L|usgal|4|x3=exactly}} → {{convert/f |10.5|L|usgal|4|x3=exactly}} |
||
There might be some bugs still, but we have waited years to have these new options. The overall concept is to reduce {Convert} to a simpler tool, with a few basic options, and then add layers of complex features by using wrapper templates, such as [[Template:Convert/spell]] or [[Template:Convert/3]], to extend the simple functionality. For example, a [[Template:Convert/flip]] would allow any options to be used in a flipped (reverse-order) conversion, without needing 540 subtemplates named "/Dual/L*A*DflipS*". Then {Convert} could be translated into the other-language Wikipedias, where the language cultures deal with U.S. units versus metric, such as descriptions of U.S. towns with road signs labelled in "miles". Currently, "disp=flip" has been widely used with other default options, but all rare options are not supported with "disp=flip", and most other languages cannot cite a source with miles and show it flipped with "kilometres" in their language. -[[User talk:Wikid77|Wikid77]] 08:40, 10 February 2013 (UTC) |
There might be some bugs still, but we have waited years to have these new options. The overall concept is to reduce {Convert} to a simpler tool, with a few basic options, and then add layers of complex features by using wrapper templates, such as [[Template:Convert/spell]] or [[Template:Convert/3]], to extend the simple functionality. For example, a [[Template:Convert/flip]] would allow any options to be used in a flipped (reverse-order) conversion, without needing 540 subtemplates named "/Dual/L*A*DflipS*". Then {Convert} could be translated into the other-language Wikipedias, where the language cultures deal with U.S. units versus metric, such as descriptions of U.S. towns with road signs labelled in "miles". Currently, "disp=flip" has been widely used with other default options, but all rare options are not supported with "disp=flip", and most other languages cannot cite a source with miles and show it flipped with "kilometres" in their language. -[[User talk:Wikid77|Wikid77]] 08:40, 10 February 2013 (UTC) |
||
==Help in porting to Gujarati Wikipedia== |
|||
I am trying to port this convert template to Gujarati Wikipedia. When template handles with plural units, it converts but it puts 's' after. To understand, what i am telling see [[gu:અમદાવાદ બીઆરટીએસ#મુખ્ય સેવામાર્ગો|this]]. Can somebody point me out which template should be manpiluated for plural changes? Thanks!--[[User:Sam.ldite| Samkit]] <sup>([[User talk:Sam.ldite|Talk]]/[[:Special:Contributions/Sam.ldite|Contributions]])</sup> 09:10, 10 February 2013 (UTC) |
Revision as of 09:10, 10 February 2013
|
|
This page has archives. Sections older than 21 days may be automatically archived by Lowercase sigmabot III when more than 1 section is present. |
For the technical discussion of template design see Template talk:Convert/Technical |
Proposal for incompatible units
Consider the following perfectly valid conversion,
- {{convert|3|mi|ft}}
following the expansion sequence we see that {{convert}} calls {{convert/mi}} which calls {{convert/LoffAoffDbSoff}} which calls {{convert/ft}}. if were to have {{convert/mi}}
pass its output unit to {{convert/ft}}
through {{convert/LoffAoffDbSoff}}
, then {{convert/ft}}
could check to see if the units make sense. I believe this is similar to what was proposed above by Wikid77, but using an auxiliary template.
Correct me if I am wrong, but I thought that all the length unit subtemplates use the same units for the "base unit", in this case meters. so, we could have {{convert/mi}}
pass "m" as the output units to {{convert/ft}}
. then, {{convert/ft}}
could check to make sure the input units match the output units.
for example,
is there anything I am missing here? Frietjes (talk) 00:36, 15 January 2013 (UTC)
- Passing an internal unit code "m" does sound like a simple way to check for mismatched units. However, currently, only a few combinations cause most trouble, so I recommend changing just those few for now, with a unit-lookup template. Long term, we could change all length-type subtemplates to check for "m" as the internal unit code. -Wikid77 (talk) 00:28, 5 February 2013 (UTC)
Using plurals with dimensions (convert/3)
Shouldn't {{convert/3|2.7|x|0.6|x|0.5|cm|in|sp=us}} be rendered with plurals, as in
- 2.7×0.6×0.5 centimeters (1.1×0.24×0.20 inches)
instead of
Thanks in advance. 67.101.5.69 (talk) 04:35, 17 January 2013 (UTC) (P.S. I already searched the archives for an answer)
- See MOS:UNITS#Unit names and symbols. As I interpret this, fully spelt out unit names should be pluralized; abbreviated unit names should not. So it should render as "2.7×0.6×0.5 centimeters (1.1×0.24×0.20 in)", since the parenthesised part normally uses abbreviated unit names. Peter coxhead (talk) 06:06, 17 January 2013 (UTC)
- Convert/3 checks for amounts < 1 to use singular: It just seemed reasonable if an amount is one or less, then the unit name is singular, as with "one-half centimeter". So for amounts >1 then it uses plural. Compare amounts:
- {{convert/3|2|x|0.6|x|0.5|cm|in|sp=us}} → Template:Convert/3
- {{convert/3|2|x|0.6|x|5.5|cm|in|sp=us}} → Template:Convert/3
- {{convert/3|2|x|0.6|x|1.0|cm|in|sp=us}} → Template:Convert/3
- For the vast majority of numbers, the unit name will be plural. Sorry for the confusion. -Wikid77 (talk) 00:28, 5 February 2013 (UTC)
Spelling error with imperial fluid ounces
Can somebody check the spelling for imperial fluid ounces? I can't find where it's embedded in the code. The error is currently manifesting in the caption for the the image at the top of Fountain pen ink. —C.Fred (talk) 15:29, 19 January 2013 (UTC)
How is this done
For Victorian Railways V class#History and Description convert 12 long tons 12 hundredweight to short ton and tonnes or 12 ton 12 cwt Peter Horn User talk 02:25, 26 January 2013 (UTC)
- see Template talk:Convert/LT, where I have made an edit request. Frietjes (talk) 16:03, 26 January 2013 (UTC)
- I have made the edit requested but have also made a few other adjustments. The problem is that "LT", "ST", "Lcwt" and "Scwt" are not abbreviations that are in use in the world (Google turns up "soft coated wheaten terrier", "leaving chilled water temperature" and "low class white trash" but not hundredweights). MOSNUM advises the long and short tons be spelt out in full. So I've disabled these abbreviations. JIMp talk·cont 03:47, 27 January 2013 (UTC)
For Fountain pen ink#Composition a conversion of 72 dyn/cm (72 × 10−3 N/m) Peter Horn User talk 02:38, 26 January 2013 (UTC)
"to(-)" does not work with abbr
An example in documentation shows that "to(-)" can be used to produce something like "60 to 170 kilograms (130–370 lb)", but it does not work with abbr=on
: for example, {{convert|60|to(-)|170|kg|lb|abbr=on}}
produces "60–170 kg (130–370 lb)" with both dashes and no "to" at all. — Mikhail Ryazanov (talk) 00:00, 29 January 2013 (UTC)
- that's because Template:Convert/to(-)/AonSoff is a redirect to Template:Convert/-/AonSoff at the moment. it would be easy to fix this, but I am wondering if there is a reason in the MOS for not allowing this. it seems like a better choice is to just use
{{convert|60|to|170|kg|lb|abbr=on}}
, if there reason for not allowing it. Frietjes (talk) 00:21, 29 January 2013 (UTC)- I don't think there is any reason for not allowing "60 to 170 kg (130–370 lb)". As an aside, you can drop the brackets in the code & just use
to-
(with the same (less then satisfactory) results). JIMp talk·cont 00:31, 29 January 2013 (UTC)
- I don't think there is any reason for not allowing "60 to 170 kg (130–370 lb)". As an aside, you can drop the brackets in the code & just use
- It should not only be allowed but is actually required in situations like "... from X to Y kg (X'–Y' lb)". Currently it produces "from X–Y kg", which is an incorrect (but for some reason quite common) notation. On the other hand, using "to" produces "... (X' to Y' lb)", which also is not good (should be better "... (from X' to Y' lb)"). I think, the template should be fixed to behave as the unabbreviated version does. — Mikhail Ryazanov (talk) 23:44, 29 January 2013 (UTC)
Template:Convert/LoffAoffDflipSmid is missing; it appears to have been moved to another specific conversion. This errors on stuff like {{convert|12.2|km|mi|adj=mid|disp=flip|-long|1}}
and other similar combinations. —Sladen (talk) 01:16, 2 February 2013 (UTC)
- Re-added for now: I have recreated that subtemplate:
- {{convert|12.2|km|mi|adj=mid|disp=flip|-long|1}} → 7.6-mile-long (12.2 km)
- However, long-term (or soon), we need to handle "=flip" in one of the {Convert/xx} wp:wrapper templates, rather than have so many "Dflip" subtemplates. I will work on this soon, to allow several more Convert options with just one new subtemplate, rather than thousands. -Wikid77 (talk) 13:11, 4 February 2013 (UTC)
Thousands/millions/billions of US gallons
Is it possible to add a function which in the case of US gallons will show instead of the full number (e.g. 210,000,000 USgal) the number in a format which includes a word "thousand", "million" or "billion" (e.g. 210 million US gallons). More precisely, the issue is with the Deepwater Horizon oil spill article. It supports formula {{convert|4.9|Moilbbl|USgal m3}}, but is it possible to make it supporting also {{convert|4.9|Moilbbl|MUSgal m3}} and {{convert|4.9|Moilbbl|e6USgal m3}}? Thank you in advance. Beagel (talk) 09:09, 4 February 2013 (UTC)
- Beware that in some countries billion means 109, in some countries it means 1012 and in quite a lot of British Commonwealth countries it recently changed from 1012 to 109 (ie old people and young people think of different numbers). However, numbers like 1,000 million are universally understood. Stepho talk 11:30, 4 February 2013 (UTC)
- Adding million should be reasonable: Although billions might be misunderstood, we could offer "million US gal" but I think the wp:MOSNUM distains the use of "million" with abbreviated unit symbols. We could allow:
- {{convert|4.9|Moilbbl|USgal m3}} → 4.9 million barrels (210,000,000 US gal; 780,000 m3)
- {{convert|4.9|Moilbbl|MUSgal m3}} → 4.9 million barrels (210 million US gal; 780,000 m3)
- I think it seems reasonable. Any objections? -Wikid77 (talk) 13:11, 4 February 2013 (UTC)
- Using {{convert|9|e9USgal}} already produces 9 billion US gallons (34 Gl). The e3 (thousand), e6 (million) and e9 (billion) prefixes go before the usual unit as you can see. Imzadi 1979 → 13:39, 4 February 2013 (UTC)
New Convert/f allows new options
After years of discussing new features, I have finally created Template:Convert/f as a Convert-format wp:wrapper template to allow rounding the input amount, to round by near=n to the nearest 'n' units, or to insert unit modifiers. There are special options with Convert/f, such as r1=2 to round the input amount to 2 decimals, comma=out to show commas only in the output amount, near=25 (or 50) to round to nearest 25, and x1 to x5 to insert text before/after the units. Some examples:
- {{convert/f |3.1415926|km|mi|r1=2}} → Template:Convert/f
- {{convert/f |9564|km|mi|comma=out}} → Template:Convert/f
- {{convert/f |9564|km|mi|lk=in|near=5}} → Template:Convert/f
- {{convert/f |10.5|L|usgal|4|x3=exactly}} → Template:Convert/f
There might be some bugs still, but we have waited years to have these new options. The overall concept is to reduce {Convert} to a simpler tool, with a few basic options, and then add layers of complex features by using wrapper templates, such as Template:Convert/spell or Template:Convert/3, to extend the simple functionality. For example, a Template:Convert/flip would allow any options to be used in a flipped (reverse-order) conversion, without needing 540 subtemplates named "/Dual/L*A*DflipS*". Then {Convert} could be translated into the other-language Wikipedias, where the language cultures deal with U.S. units versus metric, such as descriptions of U.S. towns with road signs labelled in "miles". Currently, "disp=flip" has been widely used with other default options, but all rare options are not supported with "disp=flip", and most other languages cannot cite a source with miles and show it flipped with "kilometres" in their language. -Wikid77 08:40, 10 February 2013 (UTC)
Help in porting to Gujarati Wikipedia
I am trying to port this convert template to Gujarati Wikipedia. When template handles with plural units, it converts but it puts 's' after. To understand, what i am telling see this. Can somebody point me out which template should be manpiluated for plural changes? Thanks!-- Samkit (Talk/Contributions) 09:10, 10 February 2013 (UTC)