Module:Sylheti/Digits

From Wikibooks, open books for an open world
Jump to navigation Jump to search
-- Return input text after converting en digits and month names. Testing compatibility, Unicode can be updated later. The Sylheti numeral system has similarities with Indo-Arabic  (0,1,2,3,7,8,9), Mongolian (flipped 4 & 6) and Quarter moon (5) shapes. 

local en_digits = {
	['0'] = '[[File:সিলেটি সংখ্যা ০.svg|12px]]',
	['1'] = '[[File:সিলেটি সংখ্যা ১.svg|12px]]',
	['2'] = '[[File:সিলেটি সংখ্যা ২.svg|12px]]',
	['3'] = '[[File:সিলেটি সংখ্যা ৩.svg|12px]]',
	['4'] = '[[File:সিলেটি সংখ্যা ৪.svg|12px]]',
	['5'] = '[[File:সিলেটি সংখ্যা ৫.svg|12px]]',
	['6'] = '[[File:সিলেটি সংখ্যা ৬.svg|12px]]',
	['7'] = '[[File:সিলেটি সংখ্যা ৭.svg|12px]]',
	['8'] = '[[File:সিলেটি সংখ্যা ৮.svg|12px]]',
	['9'] = '[[File:সিলেটি সংখ্যা ৯.svg|12px]]' ,
}

local en_months = {
	['January'] = 'ꠎꠣꠘꠃꠀꠞꠤ',
	['january'] = 'ꠎꠣꠘꠃꠀꠞꠤ',
	['February'] = 'ꠚꠦꠛꠃꠀꠞꠤ',
	['february'] = 'ꠚꠦꠛꠃꠀꠞꠤ',
	['March'] = 'ꠝꠣꠞ꠆ꠌ',
	['march'] = 'ꠝꠣꠞ꠆ꠌ',
	['April'] = 'ꠄꠙ꠆ꠞꠤꠟ',
	['april'] = 'ꠄꠙ꠆ꠞꠤꠟ',
	['May'] = 'ꠝꠦ',
	['may'] = 'ꠝꠦ',
	['June'] = 'ꠎꠥꠘ',
	['june'] = 'ꠎꠥꠘ',
	['July'] = 'ꠎꠥꠟꠣꠁ',
	['july'] = 'ꠎꠥꠟꠣꠁ',
	['August'] = 'ꠀꠉꠡꠐ',
	['august'] = 'ꠀꠉꠡꠐ',
	['September'] = 'ꠍꠦꠙꠐꠦꠝꠛꠞ',
	['september'] = 'ꠍꠦꠙꠐꠦꠝꠛꠞ',
	['October'] = 'ꠅꠇꠐꠥꠛꠞ',
	['october'] = 'ꠅꠇꠐꠥꠛꠞ',
	['November'] = 'ꠘꠜꠦꠝꠛꠞ',
	['november'] = 'ꠘꠜꠦꠝꠛꠞ',
	['December'] = 'ꠒꠤꠡꠦꠝꠛꠞ',
	['december'] = 'ꠒꠤꠡꠦꠝꠛꠞ',
}

local function _main(input)
	-- Callable from another module.
	input = input or ''
	return (input:gsub('%a+', en_months):gsub('%d', en_digits))
end

local function main(frame)
	-- Callable from #invoke or from a template.
	return _main(frame.args[1] or frame:getParent().args[1])
end

return { main = main, _main = _main }