Module:nup-sortkey


local export = {}
local u = mw.ustring.char
local a = u(0xF000)

local twoChars = {
	["dz"] = "d" .. a, ["gb"] = "g" .. a, ["kp"] = "k" .. a, ["sh"] = "s" .. a, ["ts"] = "t" .. a, ["zh"] = "z" .. a
}

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

return export