Jump to content

Template talk:Convert: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
m Archiving 2 discussion(s) to Template talk:Convert/Archive 3) (bot
(10 intermediate revisions by 6 users not shown)
Line 21: Line 21:
| caption2 = ... and in reality
| caption2 = ... and in reality
}}
}}

== Multiple values, shorter abbreviation? ==

Is it possible to display a shorter version than
:{{tlc|convert|149.6x71.5x8.25|2|mm|2}}
:{{convert|149.6x71.5x8.25|mm|2}}
Or?
:{{tlc|convert|149.6x71.5x8.25|mm|2|5=abbr=on}}
:{{convert|149.6x71.5x8.25|mm|2|abbr=on}}
In some infoboxes (eg, {{tl|Infobox mobile phone}}), where space is limited, it is desired to list the dimensions of some object, and its conversion, but it seems unnecessary to list the “mm” and the “in” three times. I might be missing something, but I would like an option to display something like:
:149.6 × 71.5 × 8.25 mm (5.89 × 2.82 × 0.32 in)
<span style="font-family:Avenir, sans-serif">—&nbsp;<span style="border-radius:5px;padding:.1em .4em;background:#faeded">[[User:HTGS|HTGS]]</span>&nbsp;([[User talk:HTGS|talk]])</span> 23:14, 6 November 2024 (UTC)

:Use <code>xx</code> instead of <code>x</code>.
:{{tlc|convert|149.6xx71.5xx8.25|mm|2|abbr=on}} gives {{convert|149.6xx71.5xx8.25|mm|2|abbr=on}}
:Beware that this technically violates [[MOS:UNITSYMBOLS]]. <code>|by|</code> is an option that obeys the MOS (but looks clumsier).
:{{tlc|convert|149.6|by|71.5|by|8.25|mm|2|abbr=on}} gives {{convert|149.6|by|71.5|by|8.25|mm|2|abbr=on}} <span style="border:1px solid blue;border-radius:4px;color:blue;box-shadow: 3px 3px 4px grey;">[[User:Stepho-wrs|'''&nbsp;Stepho&nbsp;''']]&nbsp;<span style="font-size:xx-small; vertical-align:top">[[User Talk:Stepho-wrs|talk]]&nbsp;</span></span> 23:49, 6 November 2024 (UTC)
::Thank you! I might actually ask at MOSNUM, because this feels like an oversight (for use in small spaces), and I’d like to standardise this across a lot of infoboxes. <span style="font-family:Avenir, sans-serif">—&nbsp;<span style="border-radius:5px;padding:.1em .4em;background:#faeded">[[User:HTGS|HTGS]]</span>&nbsp;([[User talk:HTGS|talk]])</span> 00:06, 7 November 2024 (UTC)

==Troy weight==
I'm not sure if this is the right place to discuss this, but is it possible to integrate [[troy weight]] into this template? Basically another obscure, antiquated unit of mass that still sticks around out of tradition in the precious metals industry. <b>[[User:TheTechnician27|<span style="color: #00a9ff"><i>TheTechnician27</i></span>]]</b> [[User talk:TheTechnician27|<span style="color: blue">(Talk page)</span>]] 12:23, 10 November 2024 (UTC)
:{{replyto|TheTechnician27}} It's already provided, e.g. {{tlx|convert|1|ozt|g|3}} → {{convert|1|ozt|g|3}}. See [[Template:Convert/list of units/mass|full list of mass units]]. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] &#x1f339; ([[User talk:Redrose64|talk]]) 15:48, 10 November 2024 (UTC)
::{{re|Redrose64}} Oooh, thank you! I was trying to use 'oz t' with no success. <b>[[User:TheTechnician27|<span style="color: #00a9ff"><i>TheTechnician27</i></span>]]</b> [[User talk:TheTechnician27|<span style="color: blue">(Talk page)</span>]] 17:26, 10 November 2024 (UTC)


== Indian numbering system: lakhs and crores ==
== Indian numbering system: lakhs and crores ==
Line 68: Line 45:


::The {{tlx|lakh}} and {{tlx|crore}} templates make more sense than overloading {{tlx|convert}}. <span style="border:1px solid blue;border-radius:4px;color:blue;box-shadow: 3px 3px 4px grey;">[[User:Stepho-wrs|'''&nbsp;Stepho&nbsp;''']]&nbsp;<span style="font-size:xx-small; vertical-align:top">[[User Talk:Stepho-wrs|talk]]&nbsp;</span></span> 23:07, 19 November 2024 (UTC)
::The {{tlx|lakh}} and {{tlx|crore}} templates make more sense than overloading {{tlx|convert}}. <span style="border:1px solid blue;border-radius:4px;color:blue;box-shadow: 3px 3px 4px grey;">[[User:Stepho-wrs|'''&nbsp;Stepho&nbsp;''']]&nbsp;<span style="font-size:xx-small; vertical-align:top">[[User Talk:Stepho-wrs|talk]]&nbsp;</span></span> 23:07, 19 November 2024 (UTC)

== Nautical miles to Kilometers ==

It is NOT accurate! 8000 nmi = 14,816 km not 15000. Check google & ref64 [[Bombardier Global 7500]].
The correct multiplier is 1.852 not 1.875 see ref 1 [[Nautical mile]] & for at least half a century (ref 5). [[User:Dave-okanagan|Dave-okanagan]] ([[User talk:Dave-okanagan|talk]]) 04:18, 17 December 2024 (UTC)

:The template sees 3 zeroes at the end and assumes that is the amount of rounding desired. Ie 8000 nmi +/- 500 nmi. It is not assuming 8000 nmi +/- 0.5 nmi. Therefore it rounds the output to a similar amount.
:However, you can control the rounding. Eg:
:*<code><nowiki>{{cvt|8000|nmi|km|0}}</nowiki></code> gives {{cvt|8000|nmi|km|0}} (probably not appropriate if the 8000 is a round number)
:*<code><nowiki>{{cvt|8000|nmi|km|-1}}</nowiki></code> gives {{cvt|8000|nmi|km|-1}}
:*<code><nowiki>{{cvt|8000|nmi|km|-2}}</nowiki></code> gives {{cvt|8000|nmi|km|-2}}
:*<code><nowiki>{{cvt|8000|nmi|km|-3}}</nowiki></code> gives {{cvt|8000|nmi|km|-3}} (probably the most appropriate if the 8000 is a round number)
:Choose whichever suits the situation best. Be careful of [[false precision]].<span style="border:1px solid blue;border-radius:4px;color:blue;box-shadow: 3px 3px 4px grey;">[[User:Stepho-wrs|'''&nbsp;Stepho&nbsp;''']]&nbsp;<span style="font-size:xx-small; vertical-align:top">[[User Talk:Stepho-wrs|talk]]&nbsp;</span></span> 04:56, 17 December 2024 (UTC)
:@[[User:Dave-okanagan|Dave-okanagan]]: this is discussed in the first FAQ at the top of the page as well. <span style="background:#006B54; padding:2px;">'''[[User:Imzadi1979|<span style="color:white;">Imzadi&nbsp;1979</span>]]&nbsp;[[User talk:Imzadi1979|<span style="color:white;"><big>→</big></span>]]'''</span> 05:41, 17 December 2024 (UTC)

== Suffix parameters for first and second numbers ==

Can we please get suf1 and suff2 parameters added to this template, like done at [[:Template:Change]], so that we can add references or notes to the first and second numbers in the template, respectively? Cheers, [[User:Hwy43|Hwy43]] ([[User talk:Hwy43|talk]]) 20:10, 26 December 2024 (UTC)

:The purpose of convert is to take a single number and convert it into the equivalent in different units of measurement. All numbers displayed come from that ''single'' input. So why would we need a second reference?
:Likewise, why would we have different notes for each unit of measurement? Surely a single reference and/or note cover all the units used. Can you give an example? <span style="border:1px solid blue;border-radius:4px;color:blue;box-shadow: 3px 3px 4px grey;">[[User:Stepho-wrs|'''&nbsp;Stepho&nbsp;''']]&nbsp;<span style="font-size:xx-small; vertical-align:top">[[User Talk:Stepho-wrs|talk]]&nbsp;</span></span> 23:42, 26 December 2024 (UTC)
::Good point re: single input. Rather, a suffix parameter is desired just for after the first number because it is the one that can be sourced, whereas the second is a product of the template. Same with notes being based on the first number. See the Flin Flon and Lloydminster rows at [[List of cities in Saskatchewan#List]]. In those two cases, I want the notes to be displayed after the first number, not after the second (conversion) number as currently shown. Cheers, [[User:Hwy43|Hwy43]] ([[User talk:Hwy43|talk]]) 00:29, 27 December 2024 (UTC)

:::Fair enough, this only applies to tables. The {{para|pre}} option (with the ref as the next field) can be twisted into doing what you want. <code><nowiki>{{convert|2.01|km2|sqmi|disp=table|sortable=on|adj=pre|<ref group=SK>col1 note</ref>}}</nowiki></code> gives:

{|class="wikitable"
!Column1 km<sup>2</sup>
!Column2 miles<sup>2</sup>

|-
|{{convert|2.01|km2|sqmi|disp=table|sortable=on}}<ref group=SK>old style note</ref>

|-
|{{convert|2.01|km2|sqmi|disp=table|sortable=on|adj=pre|<ref group=SK>col1 note</ref>}}

|}
''Notes:''
<references group=SK/>
:::How is that? <span style="border:1px solid blue;border-radius:4px;color:blue;box-shadow: 3px 3px 4px grey;">[[User:Stepho-wrs|'''&nbsp;Stepho&nbsp;''']]&nbsp;<span style="font-size:xx-small; vertical-align:top">[[User Talk:Stepho-wrs|talk]]&nbsp;</span></span> 02:35, 27 December 2024 (UTC)
:Don't sweat, convert is magic. Sorry, but no reference on the output which really should not need one.
:*<code><nowiki>{{convert|12.3<ref>A wise old man.</ref>|kg}}</nowiki></code> → {{convert|12.3<ref>A wise old man.</ref>|kg}}
{{reflist-talk}}
::Many thanks both of you. Both work well. Cheers, [[User:Hwy43|Hwy43]] ([[User talk:Hwy43|talk]]) 03:11, 27 December 2024 (UTC)

Revision as of 03:11, 27 December 2024

... in conception
... and in reality

Indian numbering system: lakhs and crores

Moved from Module talk:Convert. Johnuniq (talk) 01:45, 19 November 2024 (UTC)[reply]

I request that we enhance the module to include lakhs and crores.

The Indian numbering system is the main nomenclature used in South Asia to name large numbers. From the lead:

The terms lakh or 1,00,000 (one hundred thousand, written as 100,000 in Pakistan, and outside the Indian subcontinent) and crore or 1,00,00,000 (ten million, written as 10,000,000 outside the subcontinent) are the most commonly used terms in Indian English to express large numbers in the system.

This is a dimensionless unit, or if you wish, the units are integers. (Hence if implemented, the data item in 'all_units' at Module:Convert/data could be named ["ins"] for 'Indian numbering system'). Note also the main pattern of comma-separation into groups of two and three digits, not just three.

These terms should be converted to standard English terms, mostly with the term million, except for values up to 9 lakh, which could be 900,000. Sample usage in articles:

The plural sometimes has the -s, and sometimes doesn't; so both '2 lakhs' and '2 lahk' are seen; same for crore(s).

This arose at the Rfc at Wikipedia talk:Manual of Style/Dates and numbers, where in my !vote (diff) I called for using template {{Convert}}, only to realize after the fact that the template will not handle it. This conversion is badly needed, as it will resolve a sore point about usage of lakhs and crores in many articles. Thanks, Mathglot (talk) 23:46, 18 November 2024 (UTC)[reply]

Earlier discussions.
I have not yet examined the RfC at WT:Manual of Style/Dates and numbers#RfC Indian numbering conventions. The above discussions point out that lakh and crore are not units. They are like million which is also not a unit. However, if convert could do something useful that is not provided by {{lakh}} and {{crore}}, it could be investigated. Johnuniq (talk) 02:03, 19 November 2024 (UTC)[reply]
The {{lakh}} and {{crore}} templates make more sense than overloading {{convert}}.  Stepho  talk  23:07, 19 November 2024 (UTC)[reply]

Nautical miles to Kilometers

It is NOT accurate! 8000 nmi = 14,816 km not 15000. Check google & ref64 Bombardier Global 7500. The correct multiplier is 1.852 not 1.875 see ref 1 Nautical mile & for at least half a century (ref 5). Dave-okanagan (talk) 04:18, 17 December 2024 (UTC)[reply]

The template sees 3 zeroes at the end and assumes that is the amount of rounding desired. Ie 8000 nmi +/- 500 nmi. It is not assuming 8000 nmi +/- 0.5 nmi. Therefore it rounds the output to a similar amount.
However, you can control the rounding. Eg:
  • {{cvt|8000|nmi|km|0}} gives 8,000 nmi (14,816 km) (probably not appropriate if the 8000 is a round number)
  • {{cvt|8000|nmi|km|-1}} gives 8,000 nmi (14,820 km)
  • {{cvt|8000|nmi|km|-2}} gives 8,000 nmi (14,800 km)
  • {{cvt|8000|nmi|km|-3}} gives 8,000 nmi (15,000 km) (probably the most appropriate if the 8000 is a round number)
Choose whichever suits the situation best. Be careful of false precision. Stepho  talk  04:56, 17 December 2024 (UTC)[reply]
@Dave-okanagan: this is discussed in the first FAQ at the top of the page as well. Imzadi 1979  05:41, 17 December 2024 (UTC)[reply]

Suffix parameters for first and second numbers

Can we please get suf1 and suff2 parameters added to this template, like done at Template:Change, so that we can add references or notes to the first and second numbers in the template, respectively? Cheers, Hwy43 (talk) 20:10, 26 December 2024 (UTC)[reply]

The purpose of convert is to take a single number and convert it into the equivalent in different units of measurement. All numbers displayed come from that single input. So why would we need a second reference?
Likewise, why would we have different notes for each unit of measurement? Surely a single reference and/or note cover all the units used. Can you give an example?  Stepho  talk  23:42, 26 December 2024 (UTC)[reply]
Good point re: single input. Rather, a suffix parameter is desired just for after the first number because it is the one that can be sourced, whereas the second is a product of the template. Same with notes being based on the first number. See the Flin Flon and Lloydminster rows at List of cities in Saskatchewan#List. In those two cases, I want the notes to be displayed after the first number, not after the second (conversion) number as currently shown. Cheers, Hwy43 (talk) 00:29, 27 December 2024 (UTC)[reply]
Fair enough, this only applies to tables. The |pre= option (with the ref as the next field) can be twisted into doing what you want. {{convert|2.01|km2|sqmi|disp=table|sortable=on|adj=pre|<ref group=SK>col1 note</ref>}} gives:
Column1 km2 Column2 miles2
2.01 0.78[SK 1]
2.01 [SK 2] 0.78

Notes:

  1. ^ old style note
  2. ^ col1 note
How is that?  Stepho  talk  02:35, 27 December 2024 (UTC)[reply]
Don't sweat, convert is magic. Sorry, but no reference on the output which really should not need one.
  • {{convert|12.3<ref>A wise old man.</ref>|kg}} → 12.3[1] kilograms (27 lb)

References

  1. ^ A wise old man.
Many thanks both of you. Both work well. Cheers, Hwy43 (talk) 03:11, 27 December 2024 (UTC)[reply]