Module:sju-sortkey

From Wiktionary, the free dictionary
Jump to navigation Jump to search

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

local oneChar = {
	["á"] = "a" .. a, ["đ"] = "d" .. a, ["ï"] = "i" .. a, ["ŋ"] = "n" .. a, ["ŧ"] = "t" .. a, ["ü"] = "u" .. a, ["å"] = "z" .. a, ["ä"] = "z" .. b, ["ö"] = "z" .. c
}

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

return export