Jump to content

Module:smj-sortkey

From Wiktionary, the free dictionary


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

local oneChar = {
	["á"] = "a" .. a, ["ŋ"] = "n" .. a, ["ń"] = "n" .. a, ["ñ"] = "n" .. a, ["å"] = "z" .. a, ["æ"] = "z" .. b, ["ä"] = "z" .. b
}

function export.makeSortKey(text, lang, sc)
	return mw.ustring.upper(mw.ustring.gsub(mw.ustring.lower(text), ".", oneChar))
end

return export