Template talk:Convert/Archive July 2014

Range of feet/inches plus disp=flip
I would like to convert such ranges
 * 4 ft–4 ft 5 in
 * 3 ft–3 ft 11 in

Unfortunately these codes seem not to work:


 * 4 ft
 * 4 ft


 * 4 ft
 * 4 ft

Is there any way to deal with this problem (e.g. with a peculiar template)?--Carnby (talk) 21:50, 1 July 2014 (UTC)


 * 4+1/12 - 4+11/12 ft
 * Is this a suitable alternative?  Stepho  talk 22:15, 1 July 2014 (UTC)
 * Stepho has provided the only possible workaround at the moment. Input units can be complex, such as:
 * → 1 mi
 * Unfortunately such units do not accept a range. Perhaps in the future, but not in the next couple of months.
 * If desperate, you can manually work out the required values and cheat:
 * → 1.22 - 1.35 m
 * → 0.914 - 1.19 m
 * Johnuniq (talk) 06:20, 2 July 2014 (UTC)
 * Thank you, for the moment it is enough.--Carnby (talk) 07:54, 2 July 2014 (UTC)
 * Just a moment, Convert/mix2 seems to be suitable, if only a Convert/flipmix2 existed (just like Convert/flip2).--Carnby (talk) 10:08, 2 July 2014 (UTC)
 * Just a moment, Convert/mix2 seems to be suitable, if only a Convert/flipmix2 existed (just like Convert/flip2).--Carnby (talk) 10:08, 2 July 2014 (UTC)

Plural of hundredweight
I am slowly investigating some mass units connected with short and long tons. One issue concerns whether it is correct to say 2 hundredweight (which my gut and old OED tell me is correct), or 2 hundredweights (which convert can show). Frietjes asked this here in 2012. Hundredweight says "there are twenty hundredweight in a ton". Google is swamped with rubbish.

Here are some examples of the current situation: Is there a UK/US difference? (The definition for Scwt is such that the plural has no "s".) I'm inclined to change the units so there is no "s". Any thoughts?
 * → 1 Lcwt
 * → 1 Lcwt
 * → 1 long cwt
 * → 1 long cwt
 * → 1 Scwt
 * → 1 Scwt
 * → 1 short cwt
 * → 1 short cwt
 * → 2 Lcwt
 * → 2 Lcwt
 * → 2 long cwt
 * → 2 long cwt
 * → 2 Scwt
 * → 2 Scwt
 * → 2 short cwt
 * → 2 short cwt

I'm wondering this while thinking about how the combination unit LT–Lcwt–qtr should be handled in an infobox per a discussion here (Andre Kritzinger's talk). Johnuniq (talk) 10:51, 3 July 2014 (UTC)


 * I remember being taught that hundredweight is singular as well as plural, like stone. --  Ohc  ¡digame! 13:13, 3 July 2014 (UTC)

Blatant mistake on Roy Emerson
It's converted 6ft to 180cm. This is plain wrong! It converts to 182.88cm (using the coefficient 2.54). The exact parameters are 6 ft, can anyone tell me what's happened here? Perhaps it's rounding to the nearest 10cm? Renard Migrant (talk) 12:21, 3 July 2014 (UTC)


 * It's due to the rounding of the results. Since only the height in ft was specified, as a single figure, the output is rounded to two fogures. Adding |sigfig=3 or adding the inches will help. -- WOSlinker (talk) 12:54, 3 July 2014 (UTC)


 * 6 ft : 6 ft
 * 6 ft : 6 ft
 * Adding |0, 6 ft : 6 ft also works nicely. Peter Horn User talk 23:13, 4 July 2014 (UTC)

Tweaking
For Ammonia Improve 198e6 t 146.5e6 t 198e6 t 146.5e6 t Peter Horn User talk 23:07, 4 July 2014 (UTC) Peter Horn User talk 23:18, 4 July 2014 (UTC)
 * The problem is that the old article had:
 * The global industrial production of ammonia for 2012 was anticipated to be 198 million tonnes, a 35% increase over the estimated 2006 global output of 146.5 million tonnes.
 * and using one type of convert (permalink) gives:
 * The global industrial production of ammonia for 2012 was anticipated to be 198,000,000 tonnes (195,000,000 long tons; 218,000,000 short tons), a 35% increase over the estimated 2006 global output of 146,500,000 tonnes (144,200,000 long tons; 161,500,000 short tons).
 * That result is too verbose, but I do not see how convert could fix that problem. Particularly in science articles, it is probably better to stick to standard units and let readers work out any conversions they need. I do not see that it particularly matters whether the annual production was 198 or 195 or 218 million tonnes/LT/ST—it was a big number, and a conversion is unlikely to be useful.
 * In other words, I think the original article was probably best, without a convert.
 * Having said that, rather than 198e6|t it might be better to use 198|e6t as in:
 * → 198 e6t
 * → 198 e6t
 * → 198 e6t
 * Johnuniq (talk) 01:07, 5 July 2014 (UTC)

New pressure conversion
For Atmosphere (unit) 1,013,250 dyn/cm2 1,013,250 dyn/cm2 Peter Horn User talk 19:04, 4 July 2014 (UTC) Peter Horn User talk 20:39, 4 July 2014 (UTC)
 * It would be easy to add dyn/cm2 as a new unit, but let's see if there really is a need first. At Atmosphere (unit), your recent edit (diff) changed two sentences. The original article did not use convert—it had the following as plain text:
 * In 1954 the 10th Conférence Générale des Poids et Mesures (CGPM) adopted standard atmosphere for general use and affirmed its definition of being precisely equal to 1,013,250 dynes per square centimetre (101325 Pa).
 * In chemistry, the original definition of “Standard Temperature and Pressure” (STP) was a reference temperature of 0 °C (273.15 K) and pressure of 101.325 kPa (1 atm).
 * I don't think convert should be used in either of those statements. They are true by definition, and convert does not help—if convert ever rounded one of the results differently, it would be wrong in this context.
 * Using the convert template is good in general articles with wikitext like "the road is 1,250 km (780 mi) long" which should be "the road is  long". However, I'm not sure that convert is useful in the article under consideration. Johnuniq (talk) 01:22, 5 July 2014 (UTC)

Progress report
I have finally finished some details for viwiki, and have uploaded the new version of the module to the sandbox here. Soon I'll think about the problem mentioned by Frietjes in the previous section. There are a lot of changes to the module, but they are mainly for hiwiki, viwiki, and zhwiki. There is one new feature that is useful here, namely "disp=or" gives a better result if the output unit is a combination, as shown in the following (convert = current code; convert/sandbox = new code):
 * → 28 knots
 * → 123 nmi

I found a few link problems similar to what DePiep reported. I'm including some examples so I can check they work! Johnuniq (talk) 11:09, 19 June 2014 (UTC)
 * → 1 foe
 * → 1 quad
 * → 1 thou
 * → 1 cord
 * → 1 oilbbl
 * → 1 Moilbbl
 * Of course, a problem it is not. Note: none of these redirects have move/name issues to keep in mind. btw, do I understand you transplanted the convert code almost completely into these hi/vi/zh wikis? No grammar issues? That is surprising. -DePiep (talk) 19:58, 20 June 2014 (UTC)
 * Yes, the main convert module is (almost) the same on each wiki, although some are not up to date. A lot of changes were required to the module, and each wiki has the settings they require in module:convert/text. Here is a taste, but lots of complexities are not shown in this small sample:
 * bnwiki  → ১২.৩ একর (৫.০ হেক্টর)
 * hiwiki  → 12.3 एकड़ (5.0 ha)
 * viwiki  → 12,3 mẫu Anh (5,0 ha)
 * zhwiki  → 12.3英畝（5.0公頃）
 * Johnuniq (talk) 00:39, 21 June 2014 (UTC)
 * Are you saying that these 4+en: code versions are really interchangeable (those waiting in a sandbox)? Or is the "(almost)" the catch? (For example, as a thought: could one copy code to de:wiki without consulting you? -- I'm not planning to). -DePiep (talk) 20:36, 23 June 2014 (UTC)
 * No—customizations are needed (there is a transwiki guide with many gory details). As you know, there are three convert modules (and a couple more optional). The main convert module is the same on all wikis, except that many do not have up to date versions. The "(almost)" was in reference to viwiki where I decided not to bother including one minor change they made in relation to how links for some customary units like US gal appear. Copying the enwiki modules would give a convert that works just like it does here. However, there are settings in convert/text that can be changed to customize many details of how convert works, and convert/data can include local unit symbols and names. The code in the main convert module is the same (except for the tiny change at viwiki) at all wikis. The trickiest feature is "varname" which is used only at slwiki where the name of some units is variable in that it depends on the value—for example, 1 meter, 2 metra, 3 metri, 10 metrov. Johnuniq (talk) 02:36, 24 June 2014 (UTC)


 * Most other-language wikis do not need a massive Convert: After years of analysis, we found that most of the other-language wikipedias do not really need a massive Convert template. Instead, a few simple templates to handle feet/metres, miles/kilometers, pounds/kilograms, or acres/km2 would handle the bulk of the conversions, where scientific articles typically use all-metric numbers (with perhaps a few non-metric conversions). For those reasons, the other-language conversions have been very limited, and the German Wikipedia specifically rejected Convert in favor of specific conversion templates, where the rare conversion factors were repeated across just a few articles. Most conversion problems are a result of supporting American-cultural idioms (mph, or Australian or imperial units), where those users would be reading mainly the English text, but when Americans read other-language texts, they expect to see metric-only numbers in most cases and would not complain much how footballer/soccer pages give distances in metres and not yards. The evidence is overwhelming in current scientific papers, where measurements are almost never in inches or feet (or yards), compared to cm/m numbers. However, having the massive Convert as an interwiki template can help simplify literal translations, showing "ounces" or "gallons" or "inches" or feet or acres even when they are peculiar in another language. For Americans, the biggest other-language use of Convert would be in Spanish translations, but again, could be handled by a set of smaller templates for feet/metres, inches/cm/mm, miles/km, pounds/kg/g, gallons/litres, or ounces/ml. Hence, when Convert is used, it should work well, and not generate nonsense ranges, such as {convert|105|-|106|F|C}} = 105 - 106 F, where different numbers both converted into "41". The long-term solution is to use a set of smaller templates, which are easier to fix, such as convert/2    &bull; {convert/2|105|-|106|F|C} = 105–106 °F (40.6–41.1 °C) Then each smaller template can be enhanced with smarter features, such as page-wide auto-precision settings. -Wikid77 (talk) 12:26, 25 June 2014 (UTC)
 * In my discussions at a small number of wikis, I got the impression that an important reason for wanting the "full and complete" convert was so they could copy an article from enwiki and have it work without much pain—they would need to translate the text, but any converts would work (some infoboxes in articles they copy use convert). While wondering what convert needed to do for other wikis, I looked at some of the major European Wikipedias and soon realized that they don't care about convert because for them metric is the natural way of the world, and they rarely need more than SI units—I haven't looked closely, but I think that's why they are happy with a small set of convert templates, as mentioned above. Johnuniq (talk) 12:29, 26 June 2014 (UTC)
 * Interesting observations. It primarily boils down to: since those other languages don't do bi-system notation in articles usually, they don't need {convert}. But this explains the number of transclusions being low. But it does not say much about the absolute use of conversions. Why would a non-en:wiki not need to convert acres and m2 even once? If a source says "15.3 hands", what should a editor in de:wiki write? I don't see why any wiki would need less than the thousand recognised units we at enwiki have. Then, there is the consistency of parameters, and consistency of formatting within one xx:wiki. Plus, to consider: even if "a few" units are needed (which I don't think is correct), who will write & maintain & document them in sqwiki, urwiki, elwiki, azwiki? But I smiled as Wikid77 managed to squeeze in the narrow-delta-range argument.
 * There is one more argument. That is the encyclopedic value of {convert}. In itself, it describes unit conversion not just by scale, but also by cultural background, formatting, unit definition, etc. It is a repository of unit definitions. Good it is present in here, being in commons would be to the point. -DePiep (talk) 09:11, 5 July 2014 (UTC)

Nomination for deletion of Template:Convert/list of units/...
A group of "Convert/list of units/..." templates have been nominated for deletion. You are invited to comment on the discussion at the template's entry on the Templates for discussion page. Plastikspork ―Œ (talk) 00:05, 7 July 2014 (UTC)

Module version 4
The convert modules have had some minor changes for enwiki and some significant changes for other wikis. The sandbox modules have the latest versions, and I intend switching the main modules to use the sandbox soon.

Following is an overview of the changes. My next job is to restrict the syntax allowed for input fractions so only inputs like  or   or   are accepted. Some previous discussions have concerned the fact that silly inputs like  and   and   are currently accepted (respectively, these are 3.45 and 1.75 and 123.5). However, that can wait for version 5. Johnuniq (talk) 04:13, 9 July 2014 (UTC)
 * Units: Some cleaning up; replace duplicate units with an alias; fix links.
 * Rework units ST/Scwt and LT/Lcwt so  with an input multiple can show abbreviations (see here – permalink).
 * Input multiple units accept aliases so 1 mi and 1 mi both work because yard is an alias for yd.
 * For hiwiki: option  displays digits in the local language (at hiwiki, numbers default to English).
 * For hiwiki: US spelling fields use Nagari digits for units like m2.
 * For viwiki (anywhere using  for decimal mark and   for thousand separator): adapt Minh Nguyễn's idea to detect numbers with wrong decimal point.
 * For zhwiki: omit space separators with Chinese names.
 * For combination output units: enhance option  and add new option , examples:
 * Old and new version:  → 12 stone (170 lb; 76 kg)
 * New version:  → 12 stone (170 lb or 76 kg)
 * Old version:  → 12 stone or 170 pounds; 76 kilograms
 * New version:  → 12 stone or 170 pounds or 76 kilograms
 * I have updated the modules per the above. I worked on fractions but hit a roadblock ( is valid for the hands unit—12 hands $3 1/2$ inches). I'll think about that. Johnuniq (talk) 02:06, 16 July 2014 (UTC)

Future
In the long term. -DePiep (talk) 22:33, 19 July 2014 (UTC)
 * Already someone has suggested that there better be a simple unitId-to-SIdata list, and than only load the SIdata page (Pressure, length, ...). To load all huge /data/ for every first call may be too much.
 * Also, we could keep in mind the more natural writing input. For example, one enters  (quite reasonably). That input could be recognised.
 * Good, I'll be thinking about these issues, although not for a while. Re the fractions that I mentioned in the previous section, I was planning to post about that, and may as well do so here. Looking at all converts in articles, I found half a dozen bad fractions like "5-3/8" instead of "5+3/8" (they are fixed now). They were using a hyphen as a generic join character, with no intention of "-" being minus. I found a few other fraction issues where numbers like "21+10.5/16" were used but "21+21/32" was wanted—they have also been fixed (apparently the convert used at the time did not support 21/32). I'm planning to make convert very strict about what it accepts for fractions, however "12.3+1/2" is valid for hands (12 hands $3 1/2$ inches), so my current code accepts a single digit after a decimal point. Rather than add more complexity to the code, I'm planning to accept that single digit for all units. Following shows fixed wikitext of the current results:
 * → 12.3 1&frasl;2 hands (51.5 inches)
 * → 12.3 1&frasl;2 feet (154 in)
 * → [convert: invalid number ]
 * → [convert: invalid number ]
 * → 5– 3&frasl;8 foot (60.0–4.5 in)
 * In practice, "12.3+1/2" would only be used with hands. The last line shows an unfortunate problem—now that "5-3/8" is rejected, the code which tries to interpret it as a range takes over. I'm thinking about what to do with that. Perhaps just accept it because such malformed input is extremely rare, and someone would eventually notice that it is giving a silly result. Johnuniq (talk) 02:53, 20 July 2014 (UTC)

adj in combination with abbr
I want to display a number like this - 100-ha (250-acre). When I use 100 ha I get 100 ha, i.e. no hyphen in the input. Is that right? — Preceding unsigned comment added by 112.198.77.148 (talk • contribs) 00:48, 26 July 2014
 * Using adj=on (adjectival) inserts a hyphen before the name of a unit (abbr=off), but does nothing to a symbol (abbr=on). The following shows what happens in general:
 * → 100 ft
 * → 100 ft
 * → 100 ft
 * The unit acre introduces another factor because it has no symbol, and its name is always used:
 * → 100 ha
 * → 100 ha
 * → 100 ha
 * In short, convert will not generate "100-ha". If a sentence is talking about a 100 ha field, the name of the unit (hectare) would not be abbreviated. Johnuniq (talk) 01:21, 26 July 2014 (UTC)
 * Yes, that's ok. You want to write "an 100-ha (250-acre) area", so it is an adjective. But in an adjective, the symbol ha does not get a hyphen. It is "an 100 ha (250-acre) area", and "an 100-hecatare (250-acre) area". This is described in WP:UNIT. -DePiep (talk) 01:25, 26 July 2014 (UTC)

Conversion Tonnes to Long Tons failures
Conversion is non-functional ATM, all TONNES input is outputting the same numeric value for LONG TONS.

Supplementally, this may be causing editors to utilise TONNES as the main value, when an historical item's unit was actually LONG TONS. — Preceding unsigned comment added by 109.145.218.14 (talk) 12:04, 24 July 2014 (UTC)
 * In this edit you changed the first of the following converts to the second:
 * → 200 t
 * → 203 LT
 * The list of mass units is here (with the definitions here). That shows t is a tonne (metric ton), while LT is a long ton—usually there is not much difference between the rounded values. In this example, the value 200 is accentuating the issue because convert regards input "200" as a value rounded to the nearest hundred, so the output is rounded similarly by default. If it is known that 200 actually means 200±0.5, the precision can be specified:
 * → 200 t
 * Johnuniq (talk) 01:52, 26 July 2014 (UTC)

Kilowatt-hour
The symbol for kilowatt-hour should be written as a product: "kW·h", instead of "kWh", which contradicts SI and NIST rules (and even WP:UNIT). — Mikhail Ryazanov (talk) 08:19, 28 July 2014 (UTC)
 * Outside Wikipedia, "kWh" is often used, so editors have a choice:
 * → 123 kWh
 * → 123 kW.h
 * Johnuniq (talk) 09:37, 28 July 2014 (UTC)
 * I'm complaining about the opposite direction (MJ → kW·h). — Mikhail Ryazanov (talk) 10:01, 28 July 2014 (UTC)
 * What about:
 * → 440 MJ
 * Is there a specific convert that is a problem? As you say, "kW·h" is correct, but Kilowatt hour asserts 'The symbol "kWh" is most commonly used in commercial, educational, scientific and media publications' which is why convert behaves as it does. Johnuniq (talk) 11:10, 28 July 2014 (UTC)
 * I suppose that the default behavior of WP templates should follow the WP rules, which require "kW·h". ;–)
 * (The sentence about "most commonly used" is rather strange. Was it supposed to mean "Commercial, educational, scientific and media publications most commonly use the symbol "kWh". However, ..."? Because otherwise, what are the publications that are not "commercial, educational, scientific and media"? But even in that case it looks like WP:OR, drawing this conclusion from a small number of examples that actually contradict the accepted standards.)
 * Mikhail Ryazanov (talk) 11:24, 28 July 2014 (UTC)

I don't have a strong opinion on what convert should do for kWh, although I support the view that Wikipedia should follow the real world rather than lead it. The only discussion I can find is at 2008 MOSNUM. In May 2014 there were 61 converts using kWh in 36 articles, plus a couple of related units—for example, Electric car includes the correct: In May, no converts in articles used kW.h. One approach might be for me to post a list of the 36 articles containing kWh, then someone could change them to use kW.h. Something more permanent would need yet another MOS discussion, I think (WT:DATE). Johnuniq (talk) 02:27, 29 July 2014 (UTC)
 * → 11 kWh/100 km
 * → 21.25 kWh/100 km
 * Thanks for pointing at the old discussion. As I understood, only one person was advocating "kWh", whereas all other were for standard-compliance and consistency. Since our MOS already has a general rule (conforming to the standards), I do not think that introduction of exceptions for commonly misused notation is required or desirable. (I do not actually know how common in the real word this misuse is. But I know that many people say "degrees Kelvin" instead of "kelvins", which does not mean that we must make the same error here.) — Mikhail Ryazanov (talk) 05:45, 29 July 2014 (UTC)
 * I didn't investigate the history, but the take-home message from that discussion is that someone edited WP:MOSNUM to say kW·h should be used (or some other variation), however, that text has been replaced with mention of other units which absolutely must have a middle dot to make any sense. Correct or not, "kWh" is very commonly used outside Wikipedia. Planning for the convert template has always taken the view that while MOS is vital, editors should be in charge. To put it another way, I would not support changing what kWh does without a wider discussion—certainly more than our comments. Johnuniq (talk) 06:20, 29 July 2014 (UTC)
 * OK. Would you start the discussion? — Mikhail Ryazanov (talk) 06:46, 29 July 2014 (UTC)
 * Done, I have posted at WT:Manual of Style/Dates and numbers. Johnuniq (talk) 07:35, 29 July 2014 (UTC)
 * Thanks! — Mikhail Ryazanov (talk) 07:41, 29 July 2014 (UTC)