Module:Convert/text: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(update from sandbox per Template talk:Convert#Module version 9) |
(update from sandbox per Template talk:Convert#Module version 10) |
||
Line 65: | Line 65: | ||
-- Each displayed message starts with "Convert:" so can easily locate by searching article. |
-- Each displayed message starts with "Convert:" so can easily locate by searching article. |
||
cvt_format = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i>[[Help:Convert messages#%s|<span title="Convert: %s">convert: %s</span>]]</i>]</sup>%s', |
cvt_format = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i>[[Help:Convert messages#%s|<span title="Convert: %s">convert: %s</span>]]</i>]</sup>%s', |
||
cvt_format2 = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[[Help:Convert messages#%s|<span title="Convert: %s">%s</span>]]</sup>%s', |
|||
-- Each of following messages is a table: |
-- Each of following messages is a table: |
||
-- { [1] = 'title', -- mouseover title text |
-- { [1] = 'title', -- mouseover title text |
||
Line 82: | Line 83: | ||
cvt_bad_sigfig = { 'sigfig "%s" must be a positive integer' , 'invalid sigfig' , 'option', 'invalid_sigfig' }, |
cvt_bad_sigfig = { 'sigfig "%s" must be a positive integer' , 'invalid sigfig' , 'option', 'invalid_sigfig' }, |
||
cvt_empty_option = { 'Ignored empty option "%s"' , 'empty option' , 'option', 'empty_option' }, |
cvt_empty_option = { 'Ignored empty option "%s"' , 'empty option' , 'option', 'empty_option' }, |
||
cvt_deprecated = { 'Option "%s" is deprecated' , '*' , 'option', 'deprecated_option', format = 'cvt_format2' }, |
|||
cvt_no_spell = { 'Spelling is not available' , 'bug, ask for help' , 'option', 'ask_for_help' }, |
cvt_no_spell = { 'Spelling is not available' , 'bug, ask for help' , 'option', 'ask_for_help' }, |
||
cvt_unknown_option = { 'Ignored invalid option "%s"' , 'invalid option' , 'option', 'invalid_option' }, |
cvt_unknown_option = { 'Ignored invalid option "%s"' , 'invalid option' , 'option', 'invalid_option' }, |
||
Line 182: | Line 184: | ||
["sp"] = "sp", |
["sp"] = "sp", |
||
["spell"] = "spell", |
["spell"] = "spell", |
||
["stylein"] = "stylein", |
|||
["styleout"] = "styleout", |
|||
} |
} |
||
Line 194: | Line 198: | ||
-- Therefore parms.abbr will be nil, or will have one of the listed values |
-- Therefore parms.abbr will be nil, or will have one of the listed values |
||
-- that do not start with "opt_". |
-- that do not start with "opt_". |
||
-- An option value of form "xxx?" is the same as "xxx" but shows the input as deprecated. |
|||
local en_option_value = { |
local en_option_value = { |
||
-- $=x is handled as a special case: x should be a currency symbol that will be used instead of "$" |
-- $=x is handled as a special case: x should be a currency symbol that will be used instead of "$" |
||
["abbr"] = { |
["abbr"] = { |
||
-- ["local text for option value"] = "en value used in this module" |
-- ["local text for option value"] = "en value used in this module" |
||
["comma"] = "opt_nocomma", |
["comma"] = "opt_nocomma?", -- no numsep in input or output numbers |
||
["def"] = "", -- ignored (some wrapper templates call convert with "abbr=def" to mean "default abbreviation") |
["def"] = "", -- ignored (some wrapper templates call convert with "abbr=def" to mean "default abbreviation") |
||
["h"] = "on", -- abbr=on + use "h" for hand unit (default) |
["h"] = "on", -- abbr=on + use "h" for hand unit (default) |
||
Line 213: | Line 218: | ||
["adj"] = { |
["adj"] = { |
||
["1"] = "opt_singular", -- unit name is singular when value satisfies: (-1 <= v and v < 0) or (0 < v and v <= 1) |
["1"] = "opt_singular", -- unit name is singular when value satisfies: (-1 <= v and v < 0) or (0 < v and v <= 1) |
||
["flip"] = "opt_flip", |
["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_adjectival, opt_adj_mid", -- adj=on with user-specified text after input unit (between input and output) |
["mid"] = "opt_adjectival, opt_adj_mid", -- adj=on with user-specified text after input unit (between input and output) |
||
["nocomma"] = "opt_nocomma", |
["nocomma"] = "opt_nocomma?", -- no numsep in input or output numbers |
||
["off"] = "", -- ignored (off is the default) |
["off"] = "", -- ignored (off is the default) |
||
["on"] = "opt_adjectival", -- unit name is singular and hyphenated |
["on"] = "opt_adjectival", -- unit name is singular and hyphenated |
||
["pre"] = "opt_one_preunit", -- user-specified text before input unit |
["pre"] = "opt_one_preunit", -- user-specified text before input unit |
||
["ri0"] = " |
["ri0"] = "opt_ri=0", -- round input with precision = 0 |
||
["ri1"] = " |
["ri1"] = "opt_ri=1", -- round input with precision = 1 |
||
["ri2"] = " |
["ri2"] = "opt_ri=2", -- round input with precision = 2 |
||
["ri3"] = " |
["ri3"] = "opt_ri=3", -- round input with precision = 3 |
||
}, |
}, |
||
["comma"] = { |
["comma"] = { |
||
Line 235: | Line 240: | ||
}, |
}, |
||
["disp"] = { |
["disp"] = { |
||
["/"] = "or", |
["/"] = "or?", -- see "slash" |
||
["2"] = "opt_output_only", |
["2"] = "opt_output_only?", -- display only output value and symbol/name (not input) |
||
["5"] = " |
["5"] = "opt_round=5", -- round output value to nearest 5 |
||
["b"] = "b", -- join: '(...)' |
["b"] = "b", -- join: '(...)' |
||
["(or)"] = "(or)", -- join: '(...)' with 'or' between outputs in a combination |
["(or)"] = "(or)", -- join: '(...)' with 'or' between outputs in a combination |
||
Line 244: | Line 249: | ||
["comma"] = "comma", -- join: ',' |
["comma"] = "comma", -- join: ',' |
||
["flip"] = "opt_flip", -- reverse order of input/output |
["flip"] = "opt_flip", -- reverse order of input/output |
||
["flip5"] = "opt_flip, |
["flip5"] = "opt_flip, opt_round=5?", -- disp=flip + disp=5 |
||
["nocomma"] = "opt_nocomma", |
["nocomma"] = "opt_nocomma?", -- no numsep in input or output numbers |
||
["number"] = "opt_output_number_only", -- display output value (not input, and not output symbol/name) |
["number"] = "opt_output_number_only", -- display output value (not input, and not output symbol/name) |
||
["or"] = "or", -- join: 'or' |
["or"] = "or", -- join: 'or' |
||
Line 252: | Line 257: | ||
["output only"] = "opt_output_only", |
["output only"] = "opt_output_only", |
||
["preunit"] = "opt_two_preunits", -- user-specified text before input and output units |
["preunit"] = "opt_two_preunits", -- user-specified text before input and output units |
||
["s"] = "or", |
["s"] = "or?", -- see "slash" |
||
["slash"] = "or", |
["slash"] = "or?", -- 2014-11-03: "disp=slash" is now equivalent to "disp=or" as slash is unhelpful |
||
["sqbr"] = "sqbr", -- join: '[...]' |
["sqbr"] = "sqbr", -- join: '[...]' |
||
["table"] = "opt_table", -- output is suitable for a table cell with align="right" |
["table"] = "opt_table", -- output is suitable for a table cell with align="right" |
||
["tablecen"] = "opt_tablecen", -- output is suitable for a table cell with align="center" |
["tablecen"] = "opt_tablecen", -- output is suitable for a table cell with align="center" |
||
["u2"] = "opt_output_unit_only", |
["u2"] = "opt_output_unit_only?", -- display output symbol/name (not input, and not output value) |
||
["unit"] = "opt_input_unit_only", -- display input symbol/name (not output, and not input value) |
["unit"] = "opt_input_unit_only", -- display input symbol/name (not output, and not input value) |
||
["unit or text"] = "opt_input_unit_only, opt_ignore_error", -- display input symbol/name, or given unit code if not known |
["unit or text"] = "opt_input_unit_only, opt_ignore_error", -- display input symbol/name, or given unit code if not known |
||
Line 264: | Line 269: | ||
}, |
}, |
||
-- frac=x is handled as a special case: x must be an integer (possibly in local language) = 2 or more |
-- frac=x is handled as a special case: x must be an integer (possibly in local language) = 2 or more |
||
["lang"] = { |
["lang"] = { -- language for output digits (both en and local digits are always accepted for input) |
||
["en"] = "opt_lang_en", -- use en digits for numbers, regardless of local language |
["en"] = "opt_lang_en", -- use en digits for numbers, regardless of local language |
||
["local"] = "opt_lang_local", -- use local digits for numbers (default, although config can change default to en) |
["local"] = "opt_lang_local", -- use local digits for numbers (default, although config can change default to en) |
||
Line 275: | Line 280: | ||
}, |
}, |
||
["near"] = { |
["near"] = { |
||
["5"] = " |
["5"] = "opt_round=5?", -- round output value to nearest 5 |
||
}, |
}, |
||
["order"] = { |
["order"] = { |
||
Line 281: | Line 286: | ||
}, |
}, |
||
["round"] = { |
["round"] = { |
||
["5"] = " |
["5"] = "opt_round=5", -- round output value to nearest 5 |
||
[" |
["10"] = "opt_round=10", -- round output value to nearest 10 (same as but clearer than "|-1") |
||
["25"] = "opt_round=25", -- round output value to nearest 25 |
|||
["50"] = "opt_round=50", -- round output value to nearest 50 |
|||
["each"] = "opt_round_each", -- using default precision in a range, round each output separately (default uses highest precision of each item in range) |
["each"] = "opt_round_each", -- using default precision in a range, round each output separately (default uses highest precision of each item in range) |
||
}, |
}, |
||
Line 288: | Line 295: | ||
["sortable"] = { |
["sortable"] = { |
||
["off"] = "", -- ignored (off is the default) |
["off"] = "", -- ignored (off is the default) |
||
["in"] = " |
["in"] = "opt_sortable_on?", -- same as "on" |
||
["on"] = "opt_sortable_on", -- output sort key for use in a sortable table, based on value from converting to a standard base unit |
|||
["on"] = "opt_sortable_in", -- same |
|||
["out"] = " |
["out"] = "opt_sortable_on?", -- same as "on" |
||
}, |
}, |
||
["sp"] = { |
["sp"] = { |
||
Line 301: | Line 308: | ||
["On"] = "opt_spell_in, opt_spell_out, opt_spell_upper", -- same, with first letter of first word in result uppercase |
["On"] = "opt_spell_in, opt_spell_out, opt_spell_upper", -- same, with first letter of first word in result uppercase |
||
}, |
}, |
||
-- stylein=x is handled as a special case: x can be any text |
|||
-- styleout=x is handled as a special case: x can be any text |
|||
} |
} |
||