User:Johnuniq/Convert documentation

Users of {{convert}} as implemented by Module:Convert should see Help:Convert for documentation. In addition, the template's documentation page will be updated with a how-to overview.

This page provides some extra notes.

Deployment

edit

After {{convert}} is switched to use Module:Convert, some issues will need to be fixed.

Error messages

edit

The following categories should be monitored to check for problems.

Spell

edit

The old templates use {{convert/spell}} to spell numbers as words. The module works differently, and has the limitation that only the input number can be spelled.

Old templates Description For new template
|case=l Output is lowercase. Omit (lowercase is the default).
|case=L
|case=u First letter of output is uppercase. Use |spell=In (uppercase "I").
|case=U
|abbr=on Abbreviate: use symbols. Probably omit, see below.

Use the following steps to change the wikitext for convert/spell to use the module:

  • Change "/spell" to "|spell=in" (or "|spell=In" if uppercase is specified).
  • Omit |case=l.
  • Omit |abbr=on. When using spell, the old templates ignore this option, and that is probably what is wanted. However, the module will use symbols if |abbr=on is used. This option should probably be removed so that the full name of the unit is shown.

Some examples follow.

Old template New template Result from new template
{{convert/spell|1+1/2|mi|km}} {{convert|1+1/2|mi|km|spell=in}} one and a half miles (2.4 km)
{{convert/spell|1+1/2|mi|km|case=l}} {{convert|1+1/2|mi|km|spell=in}} one and a half miles (2.4 km)
{{convert/spell|1+1/2|mi|km|case=u}} {{convert|1+1/2|mi|km|spell=In}} One and a half miles (2.4 km)

Conversions that do not specify an output unit may give different results because the module uses the normal rules for determining the default output regardless of whether spelling is enabled, whereas the old templates sometimes use different defaults. For example, the input unit in (inches) normally uses mm as the default output, but uses cm with {{convert/spell}}.

Options

edit

In addition to the options listed at Help:Convert#Options, the following are defined.

Option Description
abbr=mos In a range, repeat the input unit (no longer used).
abbr=none Old equivalent for "abbr=off".
adj=off Ignored (off is the default).
near=5 Same as disp=5.
order=flip Same as disp=flip.
lang=en Output English digits, regardless of local language.
lk=off Ignored (off is the default).
sortable=off Ignored (off is the default).

The near=5 and order=flip options are experiments to produce a more logical alternative syntax with more comprehensible wikitext.

Option lang=en may be useful at other Wikipedias. For example, from the Bengali Wikipedia:

  • {{convert|1234|m|ft}} → ১,২৩৪ মিটার (৪,০৪৯ ফু)
  • {{convert|1234|m|ft|lang=en}} → 1,234 মিটার (4,049 ফু)