Anonymous user
Module:Convert/text: Difference between revisions
large refactor of messages: less visible, link to help
(put a space (actually " " so it sticks to the convert output) before warnings, per DePiep's suggestion) |
(large refactor of messages: less visible, link to help) |
||
Line 54:
}
-- One of the following categories is included in the text of each
local all_categories = {
general = "[[Category:Convert error]]",
Line 65:
-- each unit code marked like '...%{ft%}...'.
local unitcode_regex = '%%([{}])'
local unitcode_replace = { ['{'] = '
-- All messages that may be displayed if a problem occurs.
local all_messages = {
-- Message format string, %s parameters: anchor, title, text, category.
-- Each of following messages is a table:
-- { [1] = '
-- [2] = '
-- [3] = 'category key', -- key to lookup category in all_categories
-- [4] = 'anchor', -- anchor for link to relevant section on help page
-- regex = gsub_regex,
-- replace = gsub_table,
-- }
cvt_bad_default = { 'Unit "%s" has an invalid default' , 'convert: bug' , 'unknown' , 'should_not_occur' },
cvt_bad_num = { 'Value "%s" must be a number' , 'convert: invalid number' , 'general' , 'must_be_number' },
cvt_bad_prec = { '
cvt_bad_sigfig = { '
cvt_bad_unit = { 'Unit "%s" is invalid here' , 'convert: invalid unit' , 'unknown' , 'unit_invalid_here' },
cvt_big_prec = { 'Precision "%s" is too large' , 'convert: precision too large', 'general' , 'precision_too_large'},
cvt_bug_convert = { 'Bug: Cannot convert between specified units', 'convert: bug' , 'general' , 'should_not_occur' },
cvt_empty_option = { 'Ignored empty option "%s"' , 'convert: empty option' ,
cvt_invalid_num = { 'Number is too large or too small' , 'convert: too large' , 'general' , 'too_large' },
cvt_lookup = { 'Unit "%s" is incorrectly defined' , 'convert: bug' , 'general' , 'should_not_occur' },
cvt_mismatch = { 'Cannot convert "%s" to "%s"' , 'convert: dimension mismatch' , 'mismatch', 'dimension_mismatch' },
cvt_no_default = { 'Unit "%s" has no default output unit' , 'convert: bug' , 'unknown' , 'should_not_occur' },
cvt_no_num = { 'Need value' , 'convert: need value' , 'general' , 'need_value' },
cvt_no_num2 = { 'Need another value' , 'convert: need another value' , 'general' , 'need_another_value' },
cvt_no_unit = { 'Need name of unit' , 'convert: need unit' , 'unknown' , 'need_unit' },
cvt_should_be = { '%s' , 'convert: ambiguous unit' , 'general' , 'x_should_be_y', regex = unitcode_regex, replace = unitcode_replace },
cvt_unknown = { 'Unit "%s" is not known' , 'convert: unknown unit' , 'unknown' , 'unit_not_known' },
cvt_unknown_option = { 'Ignored invalid option "%s"' , 'convert: invalid option' ,
}
|