Module:Convert/text: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(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: | Line 54: | ||
} |
} |
||
-- One of the following categories is included in the text of each |
-- One of the following categories is included in the text of each message. |
||
local all_categories = { |
local all_categories = { |
||
general = "[[Category:Convert error]]", |
general = "[[Category:Convert error]]", |
||
Line 65: | Line 65: | ||
-- each unit code marked like '...%{ft%}...'. |
-- each unit code marked like '...%{ft%}...'. |
||
local unitcode_regex = '%%([{}])' |
local unitcode_regex = '%%([{}])' |
||
local unitcode_replace = { ['{'] = ' |
local unitcode_replace = { ['{'] = '"', ['}'] = '"' } -- no longer need the more elaborate substitute used before 2013-09-28 |
||
-- All messages that may be displayed if a problem occurs. |
-- All messages that may be displayed if a problem occurs. |
||
local all_messages = { |
local all_messages = { |
||
-- Message format string, %s parameters: anchor, title, text, category. |
|||
-- One of the following prefixes is inserted before each message. |
|||
cvt_format = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i>[[Help:Convert#%s|<span title="%s">%s</span>]]</i>]</sup>%s', |
|||
cvt_prefix_warning = ' <span class="noprint" style="background:peachpuff;">[[Module talk:Convert|Conversion warning]]:', |
|||
-- Each of following messages is a table: |
-- Each of following messages is a table: |
||
-- { [1] = ' |
-- { [1] = 'title', -- mouseover title text |
||
-- [2] = ' |
-- [2] = 'text', -- display text (each starts with "convert:" so can easily locate by searching article) |
||
-- [3] = 'category key', -- key to lookup category in all_categories |
|||
-- [4] = 'anchor', -- anchor for link to relevant section on help page |
|||
-- regex = gsub_regex, |
-- regex = gsub_regex, |
||
-- replace = gsub_table, |
-- replace = gsub_table, |
||
-- warning = true, -- omitted for an error message; selects cvt_prefix_error or cvt_prefix_warning |
|||
-- } |
-- } |
||
cvt_bad_default = { 'Unit "%s" has an invalid default', 'unknown' }, |
cvt_bad_default = { 'Unit "%s" has an invalid default' , 'convert: bug' , 'unknown' , 'should_not_occur' }, |
||
cvt_bad_num = { 'Value "%s" must be a number', 'general' }, |
cvt_bad_num = { 'Value "%s" must be a number' , 'convert: invalid number' , 'general' , 'must_be_number' }, |
||
cvt_bad_prec = { ' |
cvt_bad_prec = { 'Precision "%s" must be an integer' , 'convert: invalid precision' , 'option' , 'precision_must_be' }, |
||
cvt_bad_sigfig = { ' |
cvt_bad_sigfig = { 'sigfig "%s" must be a positive integer' , 'convert: invalid sigfig' , 'option' , 'sigfig_must_be' }, |
||
cvt_bad_unit = { 'Unit "%s" is invalid here', 'unknown' }, |
cvt_bad_unit = { 'Unit "%s" is invalid here' , 'convert: invalid unit' , 'unknown' , 'unit_invalid_here' }, |
||
cvt_big_prec = { 'Precision "%s" is too large', 'general' }, |
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', 'general' }, |
cvt_bug_convert = { 'Bug: Cannot convert between specified units', 'convert: bug' , 'general' , 'should_not_occur' }, |
||
cvt_empty_option = { 'Ignored empty option "%s"', 'option', |
cvt_empty_option = { 'Ignored empty option "%s"' , 'convert: empty option' , 'option' , 'empty_option' }, |
||
cvt_invalid_num = { 'Number is too large or too small', 'general' }, |
cvt_invalid_num = { 'Number is too large or too small' , 'convert: too large' , 'general' , 'too_large' }, |
||
cvt_lookup = { 'Unit "%s" is incorrectly defined', 'general' }, |
cvt_lookup = { 'Unit "%s" is incorrectly defined' , 'convert: bug' , 'general' , 'should_not_occur' }, |
||
cvt_mismatch = { 'Cannot convert "%s" to "%s"', 'mismatch' }, |
cvt_mismatch = { 'Cannot convert "%s" to "%s"' , 'convert: dimension mismatch' , 'mismatch', 'dimension_mismatch' }, |
||
cvt_no_default = { 'Unit "%s" has no default output unit', 'unknown' }, |
cvt_no_default = { 'Unit "%s" has no default output unit' , 'convert: bug' , 'unknown' , 'should_not_occur' }, |
||
cvt_no_num = { 'Need value', 'general' }, |
cvt_no_num = { 'Need value' , 'convert: need value' , 'general' , 'need_value' }, |
||
cvt_no_num2 = { 'Need another value', 'general' }, |
cvt_no_num2 = { 'Need another value' , 'convert: need another value' , 'general' , 'need_another_value' }, |
||
cvt_no_unit = { 'Need name of unit', 'unknown' }, |
cvt_no_unit = { 'Need name of unit' , 'convert: need unit' , 'unknown' , 'need_unit' }, |
||
cvt_should_be = { '%s', 'general', regex = unitcode_regex, replace = unitcode_replace }, |
cvt_should_be = { '%s' , 'convert: ambiguous unit' , 'general' , 'x_should_be_y', regex = unitcode_regex, replace = unitcode_replace }, |
||
cvt_no_spell = { 'Spelling is not available' , 'convert: bug' , 'option' , 'should_not_occur' }, |
|||
cvt_unknown = { 'Unit "%s" is not known', 'unknown' }, |
cvt_unknown = { 'Unit "%s" is not known' , 'convert: unknown unit' , 'unknown' , 'unit_not_known' }, |
||
cvt_unknown_option = { 'Ignored invalid option "%s"', 'option', |
cvt_unknown_option = { 'Ignored invalid option "%s"' , 'convert: invalid option' , 'option' , 'invalid_option' }, |
||
} |
} |
||