Jump to content

User:Johnuniq/Convert messages

From Wikipedia, the free encyclopedia

Old message format

[edit]

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:

  • <span style="color:black; background-color:orange;">Example output text</span>Example output text
  • <strong class="error">Example output text</strong>Example 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

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

[edit]

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

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

  • {{convert|12|feet|m}} → 12 ft (3.7 m)

Precision too big (positive and negative).

Option warnings.

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

  • {{convert|123|m|ft|adj=on}} → 123 m (404 ft)
  • {{convert|123|m|ft|sing=on}} → 123 m (404 ft)
  • {{convert|123|m|ft|adj=off|sing=on}} → 123 m (404 ft)[convert: invalid option]
  • {{convert|123|m|ft|adj=on|sing=off}} → 123 m (404 ft)[convert: invalid option]
  • {{convert|123|m|ft|adj=off|sing=off}} → 123 m (404 ft)
  • {{convert|123|m|ft|adj=on|sing=on}} → 123 m (404 ft)

Sigfig.

  • {{convert|123|mm|in|sigfig=3}} → 123 mm (4.84 in)
  • {{convert|123|mm|in|sigfig=}} → 123 mm (4.8 in)
  • {{convert|123|mm|in|sigfig= }} → 123 mm (4.8 in)
  • {{convert|123|mm|in|sigfig=-1}} → 123 mm (4.8 in)[convert: invalid sigfig]
  • {{convert|123|mm|in|sigfig=0}} → 123 mm (4.8 in)[convert: invalid sigfig]
  • {{convert|123|ft|m|sigfig=1.5}} → 123 ft (37 m)[convert: invalid sigfig]
  • {{convert|123|mm|in|sigfig=bogus}} → 123 mm (4.8 in)[convert: invalid sigfig]

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

  • {{convert|123|mm|in|sortable=off}} → 123 mm (4.8 in)
  • {{convert|123|mm|in|sortable=}} → 123 mm (4.8 in)
  • {{convert|123|mm|in|sortable=bogus}} → 123 mm (4.8 in)[convert: invalid option]
  • {{convert|123|mm|in|debug=yes}} → 123 mm (4.8 in)
  • {{convert|123|mm|in|sortable=on}}123 mm (4.8 in)
  • {{convert|123|mm|in|sortable=on|debug=yes}}6999123000000000000♠123 mm (4.8 in)
  • {{convert|123|mm|in|sortable=on|debug=y}}123 mm (4.8 in)[convert: invalid option]

Dimension mismatch errors.