सामग्रीमा जानुहोस्

मोड्युल:को

विकिपिडिया, एक स्वतन्त्र विश्वकोशबाट
-- বাংলা উইকিপিডিয়ার জন্য, প্রদত্ত লেখার সাথে "ের" সামঞ্জস্যবিধান

local appends = {
	-- 'র'
	['া'] = 'র',
	['ি'] = 'র',
	['ী'] = 'র',
	['ু'] = 'র',
	['ূ'] = 'র',
	['ৃ'] = 'র',
	['ে'] = 'র',
	['ৈ'] = 'র',
	['ো'] = 'র',
	['ৌ'] = 'র',
	-- 'ের'
	['ক'] = 'ের',
	['খ'] = 'ের',
	['গ'] = 'ের',
	['ঘ'] = 'ের',
	['ঙ'] = 'ের',
	['চ'] = 'ের',
	['ছ'] = 'ের',
	['জ'] = 'ের',
	['ঝ'] = 'ের',
	['ঞ'] = 'ের',
	['ট'] = 'ের',
	['ঠ'] = 'ের',
	['ড'] = 'ের',
	['ঢ'] = 'ের',
	['ণ'] = 'ের',
	['ত'] = 'ের',
	['থ'] = 'ের',
	['দ'] = 'ের',
	['ধ'] = 'ের',
	['ন'] = 'ের',
	['প'] = 'ের',
	['ফ'] = 'ের',
	['ব'] = 'ের',
	['ভ'] = 'ের',
	['ম'] = 'ের',
	['য'] = 'ের',
	['র'] = 'ের',
	['ল'] = 'ের',
	['শ'] = 'ের',
	['ষ'] = 'ের',
	['স'] = 'ের',
	['হ'] = 'ের',
	['ড়'] = 'ের',
	['ঢ়'] = 'ের',
	-- নিচের বর্ণটি 'য়'
	['়'] = 'ের',
-- 'য়ের'
--	['অ'] = 'য়ের',
--	['আ'] = 'য়ের',
	['ই'] = 'য়ের',
--	['ঈ'] = 'য়ের',
	['উ'] = 'য়ের',
--	['ঊ'] = 'য়ের',
--	['ঋ'] = 'য়ের',
--	['এ'] = 'য়ের',
--	['ঐ'] = 'য়ের',
	['ও'] = 'য়ের',
--	['ঔ'] = 'ের',
	['ং'] = 'য়ের',
}

local function fix_text(text)
	if text and text ~= '' then
		local last = mw.ustring.sub(text, -1)
		local append = appends[last]
		if append then
			return text .. append
		end
	end
	return text or ''
end

local function fix(frame)
	local args = frame:getParent().args
	return fix_text(args[1])
end

return {
	fix = fix,
	_fix = fix_text,
}