Jump to content

Module:Wp/syl/ꠉꠘꠣ ꠞꠥꠙꠣꠘ꠆ꠔꠞ

From Wikimedia Incubator
(Redirected from Module:Wp/syl/ConvertDigit)

Documentation for this module may be created at Module:Wp/syl/ꠉꠘꠣ ꠞꠥꠙꠣꠘ꠆ꠔꠞ/doc

-- Return input text after converting any en digits and month names.
--the change is made from this unicode syloti numberic doc [https://www.unicode.org/L2/L2022/22212-syloti-nagri-numerals.pdf] 
-- the numbers are added according to provided unicode Character from the doc which mentioned in the previous line
local en_digits = {
	['0'] = '০',
	['1'] = '١',
	['2'] = '٢',
	['3'] = '৩',
	['4'] = 'b',
	['5'] = '☽',
	['6'] = 'd',
	['7'] = '٧',
	['8'] = '8',
	['9'] = '٩' ,
}

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 }