Module:Convert/text: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(update from sandbox per Template talk:Convert#Module v2 soon)
(update from sandbox per Template talk:Convert:Module version 3)
Line 1: Line 1:
-- Text used by Module:Convert, for en.wikipedia.org (English).
-- Text used by Module:Convert, for en.wikipedia.org (English).
-- This is a separate module to simplify translation for use on another wiki.
-- This is a separate module to simplify translation for use on another wiki.
-- See [[:en:Template:Convert/Transwiki guide]] if copying to another wiki.


-- Some units accept an SI prefix before the unit code, such as "kg" for kilogram.
-- Some units accept an SI prefix before the unit code, such as "kg" for kilogram.
Line 111: Line 112:
-- Specifying a table requires "off" and "on" values (for "abbr=off" and "abbr=on");
-- Specifying a table requires "off" and "on" values (for "abbr=off" and "abbr=on");
-- other fields are optional.
-- other fields are optional.
-- Normally, "adj=on" uses hyphens with unabbreviated units (names, not symbols).
-- When "adj=on|abbr=off" applies, spaces in range text are replaced with hyphens.
-- However, "exception = true" means hyphens are also used with "adj=on|abbr=on".
-- With "exception = true", that also occurs with "adj=on|abbr=on".
-- If "adj" is defined here, that text is used with "adj=on" (without hyphens).
-- If "adj" is defined here, that text (unchanged) is used with "adj=on".
["+"] = " + ",
["+"] = " + ",
[","] = ", ",
[","] = ", ",
Line 122: Line 123:
["to about"] = " to about ",
["to about"] = " to about ",
["and"] = { off = " and ", on = " and ", exception = true },
["and"] = { off = " and ", on = " and ", exception = true },
["and(-)"] = { off = " and ", on = "–" },
["or"] = { off = " or " , on = " or " , exception = true },
["or"] = { off = " or " , on = " or " , exception = true },
["to"] = { off = " to " , on = " to " , exception = true },
["to"] = { off = " to " , on = " to " , exception = true },
Line 133: Line 135:
local range_aliases = {
local range_aliases = {
-- ["alternative name for a range"] = "standard range name"
-- ["alternative name for a range"] = "standard range name"
["and(-)"] = "and",
["&"] = "and",
["&"] = "and",
["–"] = "-",
["–"] = "-",
Line 146: Line 147:
-- The following "words" are accepted to make a simple range, for example, {{convert|1-2|ft}}.
-- The following "words" are accepted to make a simple range, for example, {{convert|1-2|ft}}.
-- Words must be in correct order for searching, for example, '-' after '+/-' and 'x' after 'xx'.
-- Words must be in correct order for searching, for example, '-' after '+/-' and 'x' after 'xx'.
-- Put '-' last so can have a simple range with negative values as in {{convert|-5 to -1|C}}.
local range_words = { '+/-', 'to(-)', '-', 'xx', 'x', '*', 'by', 'to', 'or' }
local range_words = { '+/-', 'to(-)', 'xx', 'x', '*', 'to', 'or', 'by', '' , '-' }


local ranges = {
local ranges = {
Line 205: Line 207:
["flip"] = "opt_flip", -- reverse order of input/output
["flip"] = "opt_flip", -- reverse order of input/output
["j"] = "opt_use_nbsp", -- "join": use " " instead of " " between value and unit name
["j"] = "opt_use_nbsp", -- "join": use " " instead of " " between value and unit name
["mid"] = "opt_adj_mid", -- adj=on with user-specified text before input unit
["mid"] = "opt_adjectival, opt_adj_mid", -- adj=on with user-specified text after input unit (between input and output)
["nocomma"] = "opt_nocomma", -- no numsep in input or output numbers
["nocomma"] = "opt_nocomma", -- no numsep in input or output numbers
["off"] = "", -- ignored (off is the default)
["off"] = "", -- ignored (off is the default)