มอดูล:alr-sortkey

จาก วิกิพจนานุกรม พจนานุกรมเสรี
local export = {}
local u = mw.ustring.char
local a = u(0xF000)
local b = u(0xF001)

local monographs = {
	["ғ"] = "г" .. b, ["ә"] = "е" .. a, ["ё"] = "е" .. b, ["ӄ"] = "к" .. a, ["ӈ"] = "н" .. a
}

local digraphs = {
	["вʼ"] = "в" .. a, ["гʼ"] = "г" .. a
}

function export.makeSortKey(text, lang, sc)
	for from, to in pairs(digraphs) do
		text = mw.ustring.gsub(text, from, to)
	end
	
	for from, to in pairs(monographs) do
		text = mw.ustring.gsub(text, from, to)
	end
	
	return text
end

return export