User:Johnuniq/Convert messages

__TOC__

Old message format

This section uses the wikitext that the module used to output.

Module:Convert can output various error and warning messages. Following is a quick wikification of the output of a test I run on a local computer. This is to give an overview for anyone interested in improving these messages. Also see Template:Convert/testcases/bytype/warnings.

One issue is the ugly orange color intended to give a very clear indication that something needs to be fixed. The current format follows, with an alternative that was specified for another project:

  • Example output textExample output text
  • Example output textExample output text

Whatever is wanted is fine with me.

I should remove the tracking categories from this page. Will do that another time.[done] I'm not sure where to invite comments, perhaps Module talk:Convert? Anywhere, including on this page, is fine. Johnuniq (talk) 02:59, 20 September 2013 (UTC)

Using "|test=msg" causes Module:Convert to patch the units table to make invalid defaults.

  • {{convert|123|chain|test=msg}}Conversion error: Unit "chain" has no default output unit
  • {{convert|123|rd|test=msg}}Conversion error: Unit "rd" has an invalid default
  • {{convert|123|ft|m|1.5}}Conversion error: Parameter precision "1.5" must be an integer
  • {{convert|1234|ft|kg}}Conversion error: Cannot convert "length" to "mass"

Precision too big (positive and negative).

  • {{convert|123|m|m|999}}Conversion error: Precision "999" is too large
  • {{convert|123|m|m|-999}} → 123 metres (0 m)

Option warnings.

Option warnings while mixing adj + sing (sing is an alias for adj).

  • {{convert|123|m|ft|adj=on}} → 123-metre (404 ft)
  • {{convert|123|m|ft|sing=on}} → 123-metre (404 ft)
  • {{convert|123|m|ft|adj=off|sing=on}} → 123-metre (404 ft)Conversion warning: Ignored invalid option "adj"
  • {{convert|123|m|ft|adj=on|sing=off}} → 123 metres (404 ft)Conversion warning: Ignored invalid option "adj"
  • {{convert|123|m|ft|adj=off|sing=off}} → 123 metres (404 ft)Conversion warning: Ignored invalid option "adj"
  • {{convert|123|m|ft|adj=on|sing=on}} → 123-metre (404 ft)Conversion warning: Ignored invalid option "adj"

Sigfig.

  • {{convert|123|mm|in|sigfig=3}} → 123 millimetres (4.84 in)
  • {{convert|123|mm|in|sigfig=}} → 123 millimetres (4.8 in)Conversion warning: Ignored empty option "sigfig"
  • {{convert|123|mm|in|sigfig= }} → 123 millimetres (4.8 in)Conversion warning: Ignored empty option "sigfig"
  • {{convert|123|mm|in|sigfig=-1}}Conversion error: Parameter sigfig "-1" must be a positive integer
  • {{convert|123|mm|in|sigfig=0}}Conversion error: Parameter sigfig "0" must be a positive integer
  • {{convert|123|ft|m|sigfig=1.5}}Conversion error: Parameter sigfig "1.5" must be a positive integer
  • {{convert|123|mm|in|sigfig=bogus}}Conversion error: Parameter sigfig "bogus" must be a positive integer

Sortable ("sortable=off" is not an error).

  • {{convert|123|mm|in|sortable=off}} → 123 millimetres (4.8 in)
  • {{convert|123|mm|in|sortable=}} → 123 millimetres (4.8 in)Conversion warning: Ignored empty option "sortable"
  • {{convert|123|mm|in|sortable=bogus}} → 123 millimetres (4.8 in)Conversion warning: Ignored invalid option "sortable=bogus"
  • {{convert|123|mm|in|debug=yes}} → 123 millimetres (4.8 in)
  • {{convert|123|mm|in|sortable=on}}7002123000000000000123 millimetres (4.8 in)
  • {{convert|123|mm|in|sortable=on|debug=yes}}7002123000000000000123 millimetres (4.8 in)
  • {{convert|123|mm|in|sortable=on|debug=y}}7002123000000000000123 millimetres (4.8 in)Conversion warning: Ignored invalid option "debug=y"

Dimension mismatch errors.

  • {{convert|1|m/s2|m2}}Conversion error: Cannot convert "acceleration" to "area"
  • {{convert|1|m2/ha|e}}Conversion error: Cannot convert "area per unit area" to "charge"
  • {{convert|1|gmol|kgCO2/L}}Conversion error: Cannot convert "chemical amount" to "co2 per unit volume"
  • {{convert|1|$/m2|$/kg}}Conversion error: Cannot convert "cost $ per unit area" to "cost $ per unit mass"
  • {{convert|1|£/ha|g/L}}Conversion error: Cannot convert "cost £ per unit area" to "density"
  • {{convert|1|J|kJ/km}}Conversion error: Cannot convert "energy" to "energy per unit length"
  • {{convert|1|kJ/g|kJ/L}}Conversion error: Cannot convert "energy per unit mass" to "energy per unit volume"
  • {{convert|1|g/km|L/h}}Conversion error: Cannot convert "exhaust emission" to "flow"
  • {{convert|1|N|L/km}}Conversion error: Cannot convert "force" to "fuel efficiency"
  • {{convert|1|kPa/m|m/km}}Conversion error: Cannot convert "fracture gradient" to "gradient"
  • {{convert|1|m|kg/m}}Conversion error: Cannot convert "length" to "linear density"
  • {{convert|1|kg|t/ha}}Conversion error: Cannot convert "mass" to "mass per unit area"
  • {{convert|1|kg/kW|kg/h}}Conversion error: Cannot convert "mass per unit power" to "mass per unit time"
  • {{convert|1|gmol/s|/sqkm}}Conversion error: Cannot convert "molar rate" to "per unit area"
  • {{convert|1|/l|PD/sqkm}}Conversion error: Cannot convert "per unit volume" to "population density"
  • {{convert|1|W|kW/t}}Conversion error: Cannot convert "power" to "power per unit mass"
  • {{convert|1|Pa|Bq}}Conversion error: Cannot convert "pressure" to "radioactivity"
  • {{convert|1|m/s|C}}Conversion error: Cannot convert "speed" to "temperature"
  • {{convert|1|C-change|g/s.kN}}Conversion error: Cannot convert "temperature change" to "thrust specific fuel consumption"
  • {{convert|1|s|Nm}}Conversion error: Cannot convert "time" to "torque"
  • {{convert|1|m3|m3/km2}}Conversion error: Cannot convert "volume" to "volume per unit area"

New message format

This section uses the live sandboxlua template to show output from the current module (the visible text says "convert", but it is calling {{tl|convert/sandboxlua2}}).

Using "|test=msg" causes Module:Convert to patch the units table to make invalid defaults.

  • {{convert|123|chain|test=msg}} → {{convert/sandboxlua2|123|chain|test=msg}}
  • {{convert|123|rd|test=msg}} → {{convert/sandboxlua2|123|rd|test=msg}}
  • {{convert}} → {{convert/sandboxlua2}}
  • {{convert|}} → {{convert/sandboxlua2|}}
  • {{convert| | }} → {{convert/sandboxlua2| | }}
  • {{convert|x|m}} → {{convert/sandboxlua2|x|m}}
  • {{convert|12}} → {{convert/sandboxlua2|12}}
  • {{convert|1.2e310|m|mm}} → {{convert/sandboxlua2|1.2e310|m|mm}}
  • {{convert|12|feet|m}} → {{convert/sandboxlua2|12|feet|m}}
  • {{convert|12|ftin|m}} → {{convert/sandboxlua2|12|ftin|m}}
  • {{convert|12|xyz|m}} → {{convert/sandboxlua2|12|xyz|m}}
  • {{convert|ft|m}} → {{convert/sandboxlua2|ft|m}}
  • {{convert|12|to|ft|m}} → {{convert/sandboxlua2|12|to|ft|m}}
  • {{convert|*12|ft|m}} → {{convert/sandboxlua2|*12|ft|m}}
  • {{convert|1.*2|ft|m}} → {{convert/sandboxlua2|1.*2|ft|m}}
  • {{convert|12|to|*34|ft|m}} → {{convert/sandboxlua2|12|to|*34|ft|m}}
  • {{convert|12|to|3.*4|ft|m}} → {{convert/sandboxlua2|12|to|3.*4|ft|m}}
  • {{convert|123|ft|m|1.5}} → {{convert/sandboxlua2|123|ft|m|1.5}}
  • {{convert|1234|ft|kg}} → {{convert/sandboxlua2|1234|ft|kg}}
  • {{convert|1|L100km}} → {{convert/sandboxlua2|1|L100km}}
  • {{convert|1|feet}} → {{convert/sandboxlua2|1|feet}}
  • {{convert|1|gallons}} → {{convert/sandboxlua2|1|gallons}}
  • {{convert|1|gallon}} → {{convert/sandboxlua2|1|gallon}}
  • {{convert|1|kilogram}} → {{convert/sandboxlua2|1|kilogram}}
  • {{convert|1|light-years}} → {{convert/sandboxlua2|1|light-years}}
  • {{convert|1|light-year}} → {{convert/sandboxlua2|1|light-year}}
  • {{convert|1|meters}} → {{convert/sandboxlua2|1|meters}}
  • {{convert|1|meter}} → {{convert/sandboxlua2|1|meter}}
  • {{convert|1|metres}} → {{convert/sandboxlua2|1|metres}}
  • {{convert|1|metre}} → {{convert/sandboxlua2|1|metre}}
  • {{convert|1|mpg}} → {{convert/sandboxlua2|1|mpg}}
  • {{convert|1|pt}} → {{convert/sandboxlua2|1|pt}}
  • {{convert|1|qt}} → {{convert/sandboxlua2|1|qt}}
  • {{convert|1|sq feet}} → {{convert/sandboxlua2|1|sq feet}}

Precision too big (positive and negative).

  • {{convert|123|m|m|999}} → {{convert/sandboxlua2|123|m|m|999}}
  • {{convert|123|m|m|-999}} → {{convert/sandboxlua2|123|m|m|-999}}

Option warnings.

  • {{convert|123|m|ft|junk=}} → {{convert/sandboxlua2|123|m|ft|junk=}}
  • {{convert|123|m|ft|junk=on}} → {{convert/sandboxlua2|123|m|ft|junk=on}}
  • {{convert|123|m|ft|adj=junk}} → {{convert/sandboxlua2|123|m|ft|adj=junk}}
  • {{convert|123|m|ft|adj=}} → {{convert/sandboxlua2|123|m|ft|adj=}}

Option warnings while mixing adj + sing (sing is an alias for adj).

  • {{convert|123|m|ft|adj=on}} → {{convert/sandboxlua2|123|m|ft|adj=on}}
  • {{convert|123|m|ft|sing=on}} → {{convert/sandboxlua2|123|m|ft|sing=on}}
  • {{convert|123|m|ft|adj=off|sing=on}} → {{convert/sandboxlua2|123|m|ft|adj=off|sing=on}}
  • {{convert|123|m|ft|adj=on|sing=off}} → {{convert/sandboxlua2|123|m|ft|adj=on|sing=off}}
  • {{convert|123|m|ft|adj=off|sing=off}} → {{convert/sandboxlua2|123|m|ft|adj=off|sing=off}}
  • {{convert|123|m|ft|adj=on|sing=on}} → {{convert/sandboxlua2|123|m|ft|adj=on|sing=on}}

Sigfig.

  • {{convert|123|mm|in|sigfig=3}} → {{convert/sandboxlua2|123|mm|in|sigfig=3}}
  • {{convert|123|mm|in|sigfig=}} → {{convert/sandboxlua2|123|mm|in|sigfig=}}
  • {{convert|123|mm|in|sigfig= }} → {{convert/sandboxlua2|123|mm|in|sigfig= }}
  • {{convert|123|mm|in|sigfig=-1}} → {{convert/sandboxlua2|123|mm|in|sigfig=-1}}
  • {{convert|123|mm|in|sigfig=0}} → {{convert/sandboxlua2|123|mm|in|sigfig=0}}
  • {{convert|123|ft|m|sigfig=1.5}} → {{convert/sandboxlua2|123|ft|m|sigfig=1.5}}
  • {{convert|123|mm|in|sigfig=bogus}} → {{convert/sandboxlua2|123|mm|in|sigfig=bogus}}

Sortable ("sortable=off" is not an error).

  • {{convert|123|mm|in|sortable=off}} → {{convert/sandboxlua2|123|mm|in|sortable=off}}
  • {{convert|123|mm|in|sortable=}} → {{convert/sandboxlua2|123|mm|in|sortable=}}
  • {{convert|123|mm|in|sortable=bogus}} → {{convert/sandboxlua2|123|mm|in|sortable=bogus}}
  • {{convert|123|mm|in|debug=yes}} → {{convert/sandboxlua2|123|mm|in|debug=yes}}
  • {{convert|123|mm|in|sortable=on}} → {{convert/sandboxlua2|123|mm|in|sortable=on}}
  • {{convert|123|mm|in|sortable=on|debug=yes}} → {{convert/sandboxlua2|123|mm|in|sortable=on|debug=yes}}
  • {{convert|123|mm|in|sortable=on|debug=y}} → {{convert/sandboxlua2|123|mm|in|sortable=on|debug=y}}

Dimension mismatch errors.

  • {{convert|1|m/s2|m2}} → {{convert/sandboxlua2|1|m/s2|m2}}
  • {{convert|1|m2/ha|e}} → {{convert/sandboxlua2|1|m2/ha|e}}
  • {{convert|1|gmol|kgCO2/L}} → {{convert/sandboxlua2|1|gmol|kgCO2/L}}
  • {{convert|1|$/m2|$/kg}} → {{convert/sandboxlua2|1|$/m2|$/kg}}
  • {{convert|1|£/ha|g/L}} → {{convert/sandboxlua2|1|£/ha|g/L}}
  • {{convert|1|J|kJ/km}} → {{convert/sandboxlua2|1|J|kJ/km}}
  • {{convert|1|kJ/g|kJ/L}} → {{convert/sandboxlua2|1|kJ/g|kJ/L}}
  • {{convert|1|g/km|L/h}} → {{convert/sandboxlua2|1|g/km|L/h}}
  • {{convert|1|N|L/km}} → {{convert/sandboxlua2|1|N|L/km}}
  • {{convert|1|kPa/m|m/km}} → {{convert/sandboxlua2|1|kPa/m|m/km}}
  • {{convert|1|m|kg/m}} → {{convert/sandboxlua2|1|m|kg/m}}
  • {{convert|1|kg|t/ha}} → {{convert/sandboxlua2|1|kg|t/ha}}
  • {{convert|1|kg/kW|kg/h}} → {{convert/sandboxlua2|1|kg/kW|kg/h}}
  • {{convert|1|gmol/s|/sqkm}} → {{convert/sandboxlua2|1|gmol/s|/sqkm}}
  • {{convert|1|/l|PD/sqkm}} → {{convert/sandboxlua2|1|/l|PD/sqkm}}
  • {{convert|1|W|kW/t}} → {{convert/sandboxlua2|1|W|kW/t}}
  • {{convert|1|Pa|Bq}} → {{convert/sandboxlua2|1|Pa|Bq}}
  • {{convert|1|m/s|C}} → {{convert/sandboxlua2|1|m/s|C}}
  • {{convert|1|C-change|g/s.kN}} → {{convert/sandboxlua2|1|C-change|g/s.kN}}
  • {{convert|1|s|Nm}} → {{convert/sandboxlua2|1|s|Nm}}
  • {{convert|1|m3|m3/km2}} → {{convert/sandboxlua2|1|m3|m3/km2}}