[go: up one dir, main page]



local export = {}
local u = mw.ustring.char

local remove_diacritics = u(0x0301) .. "-"

local oneChar = {
	["æ"] = "e"
}

function export.makeSortKey(text, lang, sc)
	text = mw.ustring.gsub(mw.ustring.lower(mw.ustring.toNFD(text)), "^h", "")
	
	return mw.ustring.upper(mw.ustring.toNFC(mw.ustring.gsub(mw.ustring.toNFD(mw.ustring.gsub(text, ".", oneChar)), "[" .. remove_diacritics .. "]", "")))
end

return export