Module:Convert is ready to be considered as a replacement for the convert templates. This page shows what needs to be considered, and I hope people will comment at Template talk:Convert#Using the convert module or at the talk page here. Johnuniq (talk) 11:06, 16 September 2013 (UTC)
MediaWiki developers want high-overhead templates replaced with modules and are not concerned about the impact on the servers from making changes like this.
Would the wikitext currently at Template:Convert work if moved to another name? That would allow comparisons between the current template and the module to be made after replacing Template:Convert with the module version.
See the convert documentation.
Done All issues here are either fixed, or were ok in the first place. Johnuniq (talk) 21:59, 24 November 2013 (UTC)
The module may have problems which would need to be fixed before its use. These are documented here.
Are there any templates (such as infoboxes) that call the current Template:Convert, and which rely on a feature of that template that is not supported by the module?
The module requires the output and input units to have the same "type", where the type is a name assigned to the unit. For example, currently
Nm
is type "torque", and ftlb
is type "energy". That means it is not possible to convert between those units:
{{convert|1200|Nm|ftlb|0|abbr=on|lk=on}}
→ 1,200 N⋅m (885 ft⋅lb){{convert/sandboxlua|1200|Nm|ftlb|0|abbr=on|lk=on}}
→ 1,200 N⋅m (885 ft⋅lb){{convert|1200|Nm|lbft|0|abbr=on|lk=on}}
→ 1,200 N⋅m (885 lb⋅ft){{convert/sandboxlua|1200|Nm|lbft|0|abbr=on|lk=on}}
→ 1,200 N⋅m (885 lb⋅ft)If required, the module can make an exception for
Nm
. Is it required? Do any other units have the magic property of being a certain type in one conversion, and a different type in another conversion?
{{convert|500|PD/sqmi|/km2}}
→ 500 inhabitants per square mile (190/km2){{convert/sandboxlua|500|PD/sqmi|/km2}}
→ 500 inhabitants per square mile (190/km2)I'm not sure what should happen with units like these. Presumably, they should be of the same type so there is no dimension mismatch? That would allow conversions between any of the units listed at Population density and Per unit area.
WP:MOSNUM states that the symbol cal
refers to a gram calorie, whereas Cal
refers to a kilogram calorie.
The definitions used by the module need to be checked: search for "calorie" at Conversion data, and see the differences at the power testcases.
If required, articles using convert/x ({{Convert/2}}, {{Convert/3}}, {{Convert/4}}, {{Convert/f}}, {{Convert/flip}}, {{Convert/flip2}}, {{Convert/flip3}}, {{Convert/flip4}}, {{Convert/scale}}, {{Convert/spell}}) would need to be checked and possibly manually adjusted to use the module. In a small number of cases, a wording workaround would be required as the module does not support arbitrary join text between items in a range (only predefined terms like "to" are possible).
Any converts that use 0 to mean "use the default output unit" would need to be adjusted because the module always interprets 0 as a rounding precision.
The units used by the module are defined at Conversion data. Nearly all the data was copied from the templates created by Jimp and it would not have been possible to develop the module without the extremely accurate and thorough unit definitions in the templates.
New units can be quickly added by editing Module:Convert/extra, but the conversion data page should be regarded as the master list of units.
Many test pages, and an accompanying module were created by WOSlinker. The tests compare the outputs from the current Template:Convert with the output from Template:Convert/sandboxlua. Following is a summary of the results as at 16 September 2013.
lb/in3
density unit, the symbol for cubic inch is "cu in
" in the module, but is the more correct "<span class="nowrap">cu in</span>
" in the template. The module output can be changed if agreed that the long symbol is wanted. What about other cubic inch occurrences?
{{convert|1|g|MTON}}
is a dimension mismatch because g
is mass while MTON is volume.
{{convert|33|e9m3|e9cuft|adj=on|abbr=off}}
and {{convert|1.23|e3m3|adj=on}}
are due to the template using "-
" for a hyphen. The template and module outputs are equivalent.
It is likely that switching to the module would reveal several problems including unknown units. Editors may report quirks, or problems may be reported in the error categories:
Only pages in the main (article) and template namespaces are listed in a category when a convert problem is detected.
In addition to the testcases, I have several thousand convert examples copied from various articles, and a test script shows that the module produces satisfactory results for these additional tests, so problems introduced by the module should be manageable.
Issues where the module is known to sometimes differ from the templates include use of
and whether a unit name should be singular or plural.
Switching to the module may introduce problems, but the current templates have issues, some of which already show bad results in articles. It is possible that introducing the module would fix some existing problems, and that should be balanced against whatever new problems would be introduced.
Articles known to have convert problems are:
hect
" instead of "ha
" as a unit. There is no way to find such problems which may due to an expectation that a particular unit should exist, or may be due to a typo. Using the module, the article would be in the "unknown unit" category.{{convert|7000|-|9900|hp|abbr=on|lk=in|disp=or}}
".cu in
" instead of "cuin
".{{convert|30|x|22|ft|m|disp=output only|abbr=on|1}}
" shows another error.mm/s
".{{convert|10|kn|mi}}
" has "kn" instead of, presumably, "km").Several other problems are shown at Convert notes.