Jump to content

Template talk:Convert

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Convert/data)
Latest comment: 3 days ago by Indefatigable in topic tenths of a thou
... in conception
... and in reality

"At three-quarter-inch centers"

[edit]

I've never come across one like this before so unless someone has the solution ready to hand, please don't spend any time on it, it can be done manually. It certainly doesn't merit a development request.

I have tried (optimistically!)

  • {{Convert|0.75|inch|mm|spell=in |adj=mid|centers}} = zero-point-seven-five-inch centers (19 mm)
  • {{Convert|{{frac|3|4}}|inch|mm|spell=in|adj=mid|centers}}} = [convert: invalid number]

Any other suggestions? 𝕁𝕄𝔽 (talk) 15:24, 9 July 2026 (UTC)Reply

{{Convert|3/4|inch|mm|spell=in|adj=mid|centers}} = three-quarters-inch centers (19 mm) is close. The other option I can think of is a workaround:
three-quarter-inch ({{convert|3/4|inch|disp=out}}) centres. = three-quarter-inch (19 mm) centres. Thryduulf (talk) 15:55, 9 July 2026 (UTC)Reply
tyvm. I was being "too clever by half" [] using {{frac}}. I almost had it. 𝕁𝕄𝔽 (talk) 16:42, 9 July 2026 (UTC)Reply
Thinking about this a bit more, I'm not certain that "three-quarters-[unit]" is ever correct grammar (at least in British English) when used as an adjective, in a similar fashion to the way that the adjective is always "foot" not "feet", regardless of how many feet there are. If I'm right on this then there is a need for a change to the template. Thryduulf (talk) 10:29, 10 July 2026 (UTC)Reply
I agree that "three-quarters-inch centres" is not colloquial BrEn. Ditto "two-feet-six centres" sb "two-foot-six centres". What an antediluvian system of measure! 𝕁𝕄𝔽 (talk) 10:45, 10 July 2026 (UTC)Reply
@JMF and Thryduulf: Might we write
at centres of {{convert|3/4|in|mm|of an|spell=in|adj=pre}}
which emits "at centres of three-quarters of an inch (19 mm)"? --Redrose64 🌹 (talk) 12:45, 11 July 2026 (UTC)Reply
Hmm, yeah, the "of an" does change the correct usage from singular to plural, but that formulation isn't always going to be possible. And thinking further both "at seven-eighth inch centres" and "at seven-eights inch centre" feel colloquially fine. I'm wondering if the simplest thing might be a parameter to force singular or plural? Thryduulf (talk) 12:54, 11 July 2026 (UTC)Reply

False positives for punctuation errors

[edit]

I am told that this template must contain formatting like {{convert|6 , 8 , 12 or 18|in|mm|0}} in order to produce the correct results. I am wondering, can this be adjusted so that it does not require creation of a false positive for a common kind of punctuation error? BD2412 T 02:56, 26 July 2026 (UTC)Reply

Examples:
  • {{convert|6 , 8 , 12 or 18|in|mm|0}} → 6, 8, 12 or 18 inches (152, 203, 305 or 457 mm)
  • {{convert|6, 8, 12 or 18|in|mm|0}} → [convert: invalid number]
I agree that this needs a better solution. Zackmann (Talk to me/What I been doing) 03:06, 26 July 2026 (UTC)Reply
I'm guessing that false positive is referring to the space-before-comma syntax, and some tool is finding that issue inside template parameters (ideally, it should skip checking wikitext inside a template). The actual syntax that convert wants is:
  • {{convert|6|,|8|,|12|or|18|in|mm|0}} → 6, 8, 12 or 18 inches (152, 203, 305 or 457 mm)
That is, each component should be in a separate argument. The first parameter in the above is 6 , 8 , 12 or 18. Convert expects that to be a number. When it finds that it isn't, it looks for various commonly used patterns such as 2+3/4 for a fraction or 2-4 for a range. It finishes by splitting the argument on whitespace, then looking for a range. That's why it wants each comma surrounded by a space. It would be unnecessary overhead for convert to specifically look for commas with no leading space particularly since there are other range specifiers. Johnuniq (talk) 04:19, 26 July 2026 (UTC)Reply
@Johnuniq: Unfortunately, reader-facing spacing errors can occur inside template parameters as readily as in running text (just consider a template with a parameter for listing corporate officers, or languages spoken in a region, or genres for a movie, or associated acts for a band), and extraneous spaces or missing spaces around punctuation will be found as ubiquitously as anywhere else. Normally, where an extra space or missing space intentionally occurs in some text, we use hidden text to denote this, e.g., SILVERDALE,<!-- -->LANCASHIRE or SILVERDALE <!-- -->, LANCASHIRE (or, with an explanation, SILVERDALE,<!-- no space -->LANCASHIRE or SILVERDALE <!-- extra space -->, LANCASHIRE). I don't know whether that would work in this template, but the text you have provided works fine. BD2412 T 17:44, 26 July 2026 (UTC)Reply

Speed in knots

[edit]

How can I add an air or water speed conversion in knots? I tried {{cvt|50|m/s|kmh|knot}}, {{cvt|50|m/s|kmh|knots}}, {{cvt|50|m/s|kmh|kt}}, and {{cvt|50|m/s|kmh|nm/h}}, but all of them generated an error message. - MPF (talk) 18:47, 28 July 2026 (UTC)Reply

Use KN ie 50 kn (95 km/h).Jason Rees (talk) 18:53, 28 July 2026 (UTC)Reply
@Jason Rees, thanks, but I just tried that, and got "Error in convert: Ignored invalid option "kn"" - MPF (talk) 21:12, 28 July 2026 (UTC)Reply
Jason's answer was {{convert|50|kn|km/h|round=5|abbr=on}} which displays as 50 kn (95 km/h) .
The reverse case is: {{convert|100|km/h|kn|0|abbr=on}} which displays as 100 km/h (54 kn) .  Stepho  talk  00:55, 29 July 2026 (UTC)Reply
The output unit is km/h (not kmh) while kn and knot are the same. Multiple output units need to be separated with a space or +. Both these work:
  • {{cvt|50|m/s|km/h knot}} → 50 m/s (180 km/h; 97 kn)
  • {{cvt|50|m/s|km/h+knot}} → 50 m/s (180 km/h; 97 kn)
Johnuniq (talk) 03:10, 29 July 2026 (UTC)Reply
@Johnuniq Super, thanks! - MPF (talk) 12:00, 29 July 2026 (UTC)Reply

Asymmetric uncertainty range

[edit]

It is impossible to convert an asymmetric uncertainty range, e.g. 123+45
−67
, using this template, despite such numbers being extremely common in science. In particular, I want to convert a number in this format from parsecs to light-years. Compare 123 ± 56 feet (37 ± 17 m). –LaundryPizza03 (dc̄) 07:49, 29 July 2026 (UTC)Reply

As it happens, a gigantic discussion now in the archive (Astronomical system of units) led to me putting a bunch of code in the sandbox. Example:
  • {{convert/sandbox|123~123~56|ft|m}} → 123+123
    −56
    feet (37+37
    −17
     m)
Unfortunately, the talented editor wanting the feature has not been active since early March and I don't want to implement something new and complex unless it is significantly used and the results are carefully checked by someone who understands the topic where it is used. Johnuniq (talk) 09:23, 29 July 2026 (UTC)Reply
Indeed, it doesn't currently handle the scientific-notation prefix notation correctly: 123+123
−56
 million feet (37×10^6+37
−17
 m) vs. 123+123
−56
×106 ft
(37+37
−17
×106 m
). Including no e-notation combinable with convert. Implementing this change should give a close-to-deployable beta for uncertainty notation. –LaundryPizza03 (dc̄) 18:00, 29 July 2026 (UTC)Reply
I was hinting at what I would want before releasing this. I would make the change if it was going to be used, and if the person using the new feature was confident they could and would verify a few different cases to confirm that it is working as needed. And check stuff like does it work when used in an article, or does the extra line height muck things up. Regarding "million": with abbr=on the result would use ×106 for both input and output. Currently, abbr=on would show ft instead of feet shown above. If needed, I could easily change unit feet to behave like mile, namely it would always show the full name ("feet" or "foot" if singular). Then e6feet could be used. Johnuniq (talk) 02:26, 30 July 2026 (UTC)Reply
Basically, if this is to be used, the e-notation prefix would need to place a modifier in the correct spot, and a new e= option will be needed for multi-valued convert arguments, such as (3–6)×104 m ((9.8–19.7)×104 ft). –LaundryPizza03 (dc̄) 03:29, 30 July 2026 (UTC)Reply

Template:Convert mu TfD

[edit]

A template for converting Mu (land) units is being discussed at Template:Convert mu TfD. Johnuniq (talk) 08:59, 30 July 2026 (UTC)Reply

Ritual expression of gratitude

[edit]

As a content creator without any technical skill of any kind, I am cosmically obligated to come by here every so often and thank the developers of this template.

the fact that {{convert|80|impgal/min|ml/sec|abbr=on}} exists and works seems like an absolute miracle to me. I love you guys so much for this monument.

This thing is an apotheosis of Wikipedia. THANK YOU jengod (talk) 19:37, 11 August 2026 (UTC)Reply

Thanks, and you’re right that it is a bit of a miracle! Johnuniq (talk) 11:46, 13 August 2026 (UTC)Reply

Input value only

[edit]

Has the ability to display the input value and suppress the unit been added? I saw it suggested back at Template talk:Convert/Archive January 2018#Return part of output: input value only. I'm trying to get 469.02 m.a.A. (1,538.8 ft) but the best I can get is 469.02 m .a.A. (1,538.8 ft) (using {{cvt|469.02|m|ft|adj=mid|.a.A.}}) which gives an odd space. CambridgeBayWeather (#1 deranged), Uqaqatigijaa (talk), Huliva 20:25, 28 August 2026 (UTC)Reply

{{cvt|469.02|m|ft|disp=x|.a.A. (|)}} gives 469.02 m.a.A. (1,538.8 ft) . Be careful of the space in the middle.  Stepho  talk  00:22, 29 August 2026 (UTC)Reply
Excellent. Thank you. CambridgeBayWeather (#1 deranged), Uqaqatigijaa (talk), Huliva 15:07, 29 August 2026 (UTC)Reply

Plural bar or bars

[edit]

Convert currently uses bars as the plural for Bar (unit). Example:

  • {{convert|2|bar|kPa}} → 2 bars (200 kPa)

A recent edit by ~2026-46880-79 at Module:Convert/documentation/conversion data proposes that the plural be bar. Talk:Bar (unit) has a couple of mentions showing that there is disagreement about what is correct (search for "plural"). Should convert say 2 bar or 2 bars? Johnuniq (talk) 03:19, 29 August 2026 (UTC)Reply

As an older Australian, I've always used "bar" as the plural. But not too fussed either way.  Stepho  talk  04:11, 29 August 2026 (UTC)Reply

Disambiguate the unit 'erg'

[edit]

Currently, the unit erg is linked to a disambiguation page, it should be linked to erg (unit). Rob3512 (Talk · C) 04:22, 6 September 2026 (UTC)Reply

Thanks. I have updated the definition and it will be live in the next release. Let me know if that is needed soon because we wait for a few changes before updating. Johnuniq (talk) 06:57, 6 September 2026 (UTC)Reply

an error

[edit]

There is a technical error at the end of the Quick start section. I could not fix it. — Hamid Hassani (talk) 03:36, 9 September 2026 (UTC)Reply

That error was intended to demonstrate what happens if the wrong code is used. It was confusing and perhaps the example could be omitted but I added a note to clarify. Johnuniq (talk) 05:55, 9 September 2026 (UTC)Reply

MGD

[edit]

Apparently this is a standard unit for volumetric flow rate. I think it means 100,000,000 U.S. gal/d (4.4 m3/s) but is there a way to incorporate the "M" for million? — Martin (MSGJ · talk) 09:01, 2 October 2026 (UTC)Reply

Never mind, worked it out! — Martin (MSGJ · talk) 09:10, 2 October 2026 (UTC)Reply
As Pakistan used to use imperial units before to some extent metricating, I'm nervous of assuming it's now using US gallons. NebY (talk) 09:20, 2 October 2026 (UTC)Reply
I don't know anything about MGD but Google confidently points to https://waterunitconverter.com/volumetricflow which claims that 1 MGD = 1.547 cfs = 694.44 gpm = 43.813 L/s. That site uses US gallons.
  • {{convert|1|E6USgal/day|L/s|3}} → 1 million US gallons per day (43.813 L/s)
Johnuniq (talk) 10:11, 2 October 2026 (UTC)Reply

tenths of a thou

[edit]

At Carbon fibers there was a recent change to show "5 to 10 micrometers (2⁄10,000 to 4⁄10,000 of an inch)". I'm not against how it displays to the reader but I can't find a way to use convert. |frac= doesn't seem to work with input units of |μm - just displays 0 . I could use {{convert|5|to(-)|10|μm|thou|sp=us|link=on}} to show 5 to 10 micrometers (0.20–0.39 thou) but thou is still a bit unknown for many readers (even in the US), so I'd like to keep the fraction form. Any clues?  Stepho  talk  23:44, 10 October 2026 (UTC)Reply

Hmmm. Convert can do it but it cleverly reduces the fractions. For example, instead of saying something was 4⁄8 inches, it would say 1⁄2. The following is correct but is not as clean as the original using a tenth thou.
  • {{convert|5|to(-)|10|μm|in|frac=10000|sp=us|link=on}} → 5 to 10 micrometers (1⁄5000–1⁄2500 in)
There is no way to specify that the fractions should not be reduced. Johnuniq (talk) 00:41, 11 October 2026 (UTC)Reply
I happened to find a way to defeat the automatic reduction but it's not quite what anyone would want. 😒
{{convert|5|to(-)|10|μm|thou|sp=us|frac=10000|link=on}} → 5 to 10 micrometers (1969⁄10000–3937⁄10000 thou) NebY (talk) 00:53, 11 October 2026 (UTC)Reply
Thanks guys. I had a typo in my attempts in the article, which is why it didn't work for me. Works now (albeit with reduced fractions and no commas in the fraction).  Stepho  talk  04:35, 12 October 2026 (UTC)Reply
We should remember that the reason for converting measurements is to help people who are more familiar with visualizing the measure in the output units. Are there really any readers who will say, “5 to 10 micrometres? WTF’s that?” and then say, “1⁄5000 to 1⁄2500 inch, OK that’s better, that’s the type of measurement I deal with every day”? I think no conversion is necessary with things like this, as industries working with items this small use micrometres in all countries, even in the US. Indefatigable (talk) 05:00, 12 October 2026 (UTC)Reply