User:Johnuniq/Convert messages
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}}
→ Conversion error: Need value{{convert|}}
→ Conversion error: Need value{{convert| | }}
→ Conversion error: Need value{{convert|x|m}}
→ Conversion error: Value "x" must be a number{{convert|12}}
→ Conversion error: Need name of unit{{convert|1.2e310|m|mm}}
→ Conversion error: Number is too large or too small
{{convert|12|feet|m}}
→ Conversion error: Useft
(notfeet
)
{{convert|12|ftin|m}}
→ Conversion error: Unit "ftin" is invalid here
{{convert|12|xyz|m}}
→ Conversion error: Unit "xyz" is not known
{{convert|ft|m}}
→ Conversion error: Value "ft" must be a number{{convert|12|to|ft|m}}
→ Conversion error: Value "ft" must be a number
{{convert|*12|ft|m}}
→ Conversion error: Value "*12" must be a number{{convert|1.*2|ft|m}}
→ Conversion error: Value "1.*2" must be a number{{convert|12|to|*34|ft|m}}
→ Conversion error: Value "*34" must be a number{{convert|12|to|3.*4|ft|m}}
→ Conversion error: Value "3.*4" must be a number
{{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"
{{convert|1|L100km}}
→ Conversion error: UseL/100 km
(notL100km
){{convert|1|feet}}
→ Conversion error: Useft
(notfeet
){{convert|1|gallons}}
→ Conversion error: UseUSgal
for US gallons orimpgal
for imperial gallons (notgallon
){{convert|1|gallon}}
→ Conversion error: UseUSgal
for US gallons orimpgal
for imperial gallons (notgallon
){{convert|1|kilogram}}
→ Conversion error: Usekg
(notkilogram
){{convert|1|light-years}}
→ Conversion error: Usely
(notlight-years
){{convert|1|light-year}}
→ Conversion error: Usely
(notlight-year
){{convert|1|meters}}
→ Conversion error: Usem
(notmeters
){{convert|1|meter}}
→ Conversion error: Usem
(notmeter
){{convert|1|metres}}
→ Conversion error: Usem
(notmetres
){{convert|1|metre}}
→ Conversion error: Usem
(notmetre
){{convert|1|mpg}}
→ Conversion error: Usempgus
for miles per US gallon ormpgimp
for miles per imperial gallon (notmpg
){{convert|1|pt}}
→ Conversion error: UseUSpt
for US pints orimppt
for imperial pints (notpt
){{convert|1|qt}}
→ Conversion error: UseUSqt
for US quarts orimpqt
for imperial quarts (notqt
){{convert|1|sq feet}}
→ Conversion error: Usesqft
(notsq feet
)
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.
{{convert|123|m|ft|junk=}}
→ Conversion warning: Ignored invalid option "junk="{{convert|123|m|ft|junk=on}}
→ Conversion warning: Ignored invalid option "junk=on"{{convert|123|m|ft|adj=junk}}
→ Conversion warning: Ignored invalid option "adj=junk"{{convert|123|m|ft|adj=}}
→ Conversion warning: Ignored empty option "adj"
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}}
→ 123 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}}
→ 123 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|123|chain|test=msg}}
→ 123 chains ([convert: bug, ask for help]){{convert|123|rd|test=msg}}
→ 123 rd ([convert: bug, ask for help])
{{convert}}
→ [convert: needs a number]{{convert|}}
→ [convert: needs a number]{{convert| | }}
→ [convert: needs a number]{{convert|x|m}}
→ [convert: invalid number]{{convert|12}}
→ 12[convert: needs unit name]{{convert|1.2e310|m|mm}}
→ [convert: number overflow]
{{convert|12|feet|m}}
→ 12 ft (3.7 m)
{{convert|12|ftin|m}}
→ 12 ftin[convert: unit invalid here]
{{convert|12|xyz|m}}
→ 12 xyz[convert: unknown unit]
{{convert|ft|m}}
→ [convert: invalid number]{{convert|12|to|ft|m}}
→ [convert: invalid number]
{{convert|*12|ft|m}}
→ [convert: invalid number]{{convert|1.*2|ft|m}}
→ 1×2 ft (0.30×0.61 m){{convert|12|to|*34|ft|m}}
→ [convert: invalid number]{{convert|12|to|3.*4|ft|m}}
→ 12 to 3×4 ft (3.66 to 0.91×1.22 m)
{{convert|123|ft|m|1.5}}
→ 123 ft (37 m)[convert: invalid precision]
{{convert|1234|ft|kg}}
→ 1,234 ft ([convert: unit mismatch])
{{convert|1|L100km}}
→ 1 L100km[convert: unknown unit]{{convert|1|feet}}
→ 1 ft (0.30 m){{convert|1|gallons}}
→ 1 gallons[convert: ambiguous unit]{{convert|1|gallon}}
→ 1 gallon[convert: ambiguous unit]{{convert|1|kilogram}}
→ 1 kg (2.2 lb){{convert|1|light-years}}
→ 1 light-years[convert: unknown unit]{{convert|1|light-year}}
→ 1 ly (63,000 AU){{convert|1|meters}}
→ 1 m (3 ft 3 in){{convert|1|meter}}
→ 1 m (3 ft 3 in){{convert|1|metres}}
→ 1 m (3 ft 3 in){{convert|1|metre}}
→ 1 m (3 ft 3 in){{convert|1|mpg}}
→ 1 mpg[convert: ambiguous unit]{{convert|1|pt}}
→ 1 pt[convert: ambiguous unit]{{convert|1|qt}}
→ 1 qt[convert: ambiguous unit]{{convert|1|sq feet}}
→ 1 sq feet[convert: unknown unit]
Precision too big (positive and negative).
{{convert|123|m|m|999}}
→ [convert: precision too large]{{convert|123|m|m|-999}}
→ 123 m (0 m)
Option warnings.
{{convert|123|m|ft|junk=}}
→ 123 m (404 ft)[convert: invalid option]{{convert|123|m|ft|junk=on}}
→ 123 m (404 ft)[convert: invalid option]{{convert|123|m|ft|adj=junk}}
→ 123 m (404 ft)[convert: invalid option]{{convert|123|m|ft|adj=}}
→ 123 m (404 ft)
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.
{{convert|1|m/s2|m2}}
→ 1 m/s2 ([convert: unit mismatch]){{convert|1|m2/ha|e}}
→ 1 m2/ha ([convert: unit mismatch]){{convert|1|gmol|kgCO2/L}}
→ 1 gmol ([convert: unit mismatch]){{convert|1|$/m2|$/kg}}
→ $1/m2 ([convert: unit mismatch]){{convert|1|£/ha|g/L}}
→ £1/ha ([convert: unit mismatch]){{convert|1|J|kJ/km}}
→ 1 J ([convert: unit mismatch]){{convert|1|kJ/g|kJ/L}}
→ 1 kJ/g ([convert: unit mismatch]){{convert|1|g/km|L/h}}
→ 1 g/km ([convert: unit mismatch]){{convert|1|N|L/km}}
→ 1 N ([convert: unit mismatch]){{convert|1|kPa/m|m/km}}
→ 1 kPa/m ([convert: unit mismatch]){{convert|1|m|kg/m}}
→ 1 m ([convert: unit mismatch]){{convert|1|kg|t/ha}}
→ 1 kg ([convert: unit mismatch]){{convert|1|kg/kW|kg/h}}
→ 1 kg/kW ([convert: unit mismatch]){{convert|1|gmol/s|/sqkm}}
→ 1 gmol/s ([convert: unit mismatch]){{convert|1|/l|PD/sqkm}}
→ 1/l ([convert: unit mismatch]){{convert|1|W|kW/t}}
→ 1 W ([convert: unit mismatch]){{convert|1|Pa|Bq}}
→ 1 Pa ([convert: unit mismatch]){{convert|1|m/s|C}}
→ 1 m/s ([convert: unit mismatch]){{convert|1|C-change|g/s.kN}}
→ 1 °C ([convert: unknown unit]){{convert|1|s|Nm}}
→ 1 s ([convert: unit mismatch]){{convert|1|m3|m3/km2}}
→ 1 m3 ([convert: unit mismatch])