Changes

Module:Convert/text

793 bytes added, 9 years ago
update from sandbox per [[Template talk:Convert#Module version 10]]
-- 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_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:
-- { [1] = 'title', -- mouseover title text
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_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_unknown_option = { 'Ignored invalid option "%s"' , 'invalid option' , 'option', 'invalid_option' },
["sp"] = "sp",
["spell"] = "spell",
["stylein"] = "stylein",
["styleout"] = "styleout",
}
-- Therefore parms.abbr will be nil, or will have one of the listed values
-- 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 = {
-- $=x is handled as a special case: x should be a currency symbol that will be used instead of "$"
["abbr"] = {
-- ["local text for option value"] = "en value used in this module"
["comma"] = "opt_nocomma?", -- no numsep in input or output numbers
["def"] = "", -- ignored (some wrapper templates call convert with "abbr=def" to mean "default abbreviation")
["h"] = "on", -- abbr=on + use "h" for hand unit (default)
["adj"] = {
["1"] = "opt_singular", -- unit name is singular when value satisfies: (-1 <= v and v < 0) or (0 < v and v <= 1)
["flip"] = "opt_flip?", -- reverse order of input/output
["j"] = "opt_use_nbsp", -- "join": use "&nbsp;" 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)
["nocomma"] = "opt_nocomma?", -- no numsep in input or output numbers
["off"] = "", -- ignored (off is the default)
["on"] = "opt_adjectival", -- unit name is singular and hyphenated
["pre"] = "opt_one_preunit", -- user-specified text before input unit
["ri0"] = "ri0opt_ri=0", -- round input with precision = 0 ["ri1"] = "ri1opt_ri=1", -- round input with precision = 1 ["ri2"] = "ri2opt_ri=2", -- round input with precision = 2 ["ri3"] = "ri3opt_ri=3", -- round input with precision = 3
},
["comma"] = {
},
["disp"] = {
["/"] = "or?", -- see "slash" ["2"] = "opt_output_only?", -- display only output value and symbol/name (not input) ["5"] = "opt_round5opt_round=5", -- round output value to nearest 5
["b"] = "b", -- join: '(...)'
["(or)"] = "(or)", -- join: '(...)' with 'or' between outputs in a combination
["comma"] = "comma", -- join: ','
["flip"] = "opt_flip", -- reverse order of input/output
["flip5"] = "opt_flip, opt_round5opt_round=5?", -- disp=flip + disp=5 ["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)
["or"] = "or", -- join: 'or'
["output only"] = "opt_output_only",
["preunit"] = "opt_two_preunits", -- user-specified text before input and output units
["s"] = "or?", -- see "slash" ["slash"] = "or?", -- 2014-11-03: "disp=slash" is now equivalent to "disp=or" as slash is unhelpful
["sqbr"] = "sqbr", -- join: '[...]'
["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"
["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 or text"] = "opt_input_unit_only, opt_ignore_error", -- display input symbol/name, or given unit code if not known
},
-- frac=x is handled as a special case: x must be an integer (possibly in local language) = 2 or more
["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
["local"] = "opt_lang_local", -- use local digits for numbers (default, although config can change default to en)
},
["near"] = {
["5"] = "opt_round5opt_round=5?", -- round output value to nearest 5
},
["order"] = {
},
["round"] = {
["5"] = "opt_round5opt_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_round25opt_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)
},
["sortable"] = {
["off"] = "", -- ignored (off is the default)
["in"] = "opt_sortable_inopt_sortable_on?", -- output numeric hidden sort field for use in a sortable table, based same as "on input" ["on"] = "opt_sortable_inopt_sortable_on", -- sameoutput sort key for use in a sortable table, based on value from converting to a standard base unit ["out"] = "opt_sortable_outopt_sortable_on?", -- same, based as "on output"
},
["sp"] = {
["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
}
Anonymous user