Module:ConvertDigit

অসমীয়া ৱিকিপিডিয়াৰ পৰা
Jump to navigation Jump to search

Documentation for this module may be created at Module:ConvertDigit/doc

-- Return input text after converting any en digits and month names.

local en_digits = {
	['0'] = '০',
	['1'] = '১',
	['2'] = '২',
	['3'] = '৩',
	['4'] = '৪',
	['5'] = '৫',
	['6'] = '৬',
	['7'] = '৭',
	['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 }