Module:Convert/text: Difference between revisions

simplify language handler
(extra range types needed for ranges of more than two values)
(simplify language handler)
Line 1:
--[[ Text used by Module:Convert, for en.wikipedia.org (English).
 
This is a separate module to simplify translation for use on another wiki.
Line 12:
sigfig=3 To set number of output significant figures.
]]
 
local translation_table = {
-- Tables to translate digits from/to en.
-- The to_en table can be calculated from the from_en table, but that
-- overhead seems excessive for each convert.
-- Will not try to put many languages here; this is mainly for testing.
test = {
-- For Johnuniq's test system; will remove later.
from_en = {
['0'] = '<0>',
['1'] = '<1>',
['2'] = '<2>',
['3'] = '<3>',
['4'] = '<4>',
['5'] = '<5>',
['6'] = '<6>',
['7'] = '<7>',
['8'] = '<8>',
['9'] = '<9>',
},
to_en = {
['<0>'] = '0',
['<1>'] = '1',
['<2>'] = '2',
['<3>'] = '3',
['<4>'] = '4',
['<5>'] = '5',
['<6>'] = '6',
['<7>'] = '7',
['<8>'] = '8',
['<9>'] = '9',
}
},
bn = {
-- Bengali (bn.wikipedia.org).
group = 2, -- group numbers 3 digits, then 2 digits
plural_suffix = '', -- disable plural unit names
from_en = {
['0'] = '০',
['1'] = '১',
['2'] = '২',
['3'] = '৩',
['4'] = '৪',
['5'] = '৫',
['6'] = '৬',
['7'] = '৭',
['8'] = '৮',
['9'] = '৯',
},
to_en = {
['০'] = '0',
['১'] = '1',
['২'] = '2',
['৩'] = '3',
['৪'] = '4',
['৫'] = '5',
['৬'] = '6',
['৭'] = '7',
['৮'] = '8',
['৯'] = '9',
},
}
}
 
-- Some units accept an SI prefix before the unit code, such as "kg" for kilogram.
Line 155 ⟶ 92:
cvt_empty_option = { 'Ignored empty option "%s"', 'option', warning = true },
cvt_invalid_num = { 'Number is too large or too small', 'general' },
cvt_lookup = { 'Unit "%s" is incorrectly defined', 'general' },
cvt_mismatch = { 'Cannot convert "%s" to "%s"', 'mismatch' },
cvt_no_default = { 'Unit "%s" has no default output unit', 'unknown' },
Line 323 ⟶ 261:
range_aliases = range_aliases,
range_types = range_types,
translation_table = translation_table,
}
Anonymous user