Module:Convert/text: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(simplify language handler)
(define en_option_name so can check for unknown options; can translate all options)
Line 6: Line 6:
* Module:Convert/data (unit definitions)
* Module:Convert/data (unit definitions)
* Module:Convert/text (parameter and message definitions)
* Module:Convert/text (parameter and message definitions)

In addition to the parameters defined here, Module:Convert accepts built-in
parameters shown in the following examples:
debug=yes Can be used with sortable=on.
sigfig=3 To set number of output significant figures.
]]
]]


Line 147: Line 142:


-- Valid option names.
-- Valid option names.
local local_option_name = {
local en_option_name = {
-- ["en name used in this module"] = "local text for option name"
-- ["local text for option name"] = "en name used in this module"
["abbr"] = "abbr",
["abbr"] = "abbr",
["adj"] = "adj",
["adj"] = "adj",
["debug"] = "debug",
["disp"] = "disp",
["disp"] = "disp",
["comma"] = "comma",
["comma"] = "comma",
["lang"] = "lang",
["lang"] = "lang",
["lk"] = "lk",
["lk"] = "lk",
["sing"] = "sing",
["sigfig"] = "sigfig",
["sing"] = "adj", -- "sing" is an old alias for "adj"
["sortable"] = "sortable",
["sortable"] = "sortable",
["sp"] = "sp",
["sp"] = "sp",
Line 227: Line 224:
["gaps"] = "opt_gaps", -- use gaps, not numsep, to separate groups of digits
["gaps"] = "opt_gaps", -- use gaps, not numsep, to separate groups of digits
["gaps5"] = "opt_gaps, opt_comma5", -- opt_gaps + opt_comma5
["gaps5"] = "opt_gaps, opt_comma5", -- opt_gaps + opt_comma5
},
["debug"] = {
["yes"] = "opt_sortable_debug", -- make the normally hidden sort key visible
},
},
["lang"] = {
["lang"] = {
Line 237: Line 237:
["out"] = "out", -- link RHS unit name or symbol
["out"] = "out", -- link RHS unit name or symbol
},
},
-- sigfig=x is handled as a special case: x must be an integer (possibly in local language) = 1 or more
["sortable"] = {
["sortable"] = {
["off"] = "", -- ignored (off is the default)
["off"] = "", -- ignored (off is the default)
Line 256: Line 257:
customary_units = customary_units,
customary_units = customary_units,
disp_joins = disp_joins,
disp_joins = disp_joins,
en_option_name = en_option_name,
en_option_value = en_option_value,
en_option_value = en_option_value,
eng_scales = eng_scales,
eng_scales = eng_scales,
local_option_name = local_option_name,
range_aliases = range_aliases,
range_aliases = range_aliases,
range_types = range_types,
range_types = range_types,