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

local oneChar = {
	["ґ"] = "г" .. a, ["є"] = "е" .. a, ["ё"] = "е" .. b, ["і"] = "и", ["ї"] = "и" .. a, ["ы"] = "и" .. c, ["ѣ"] = "щ" .. a, ["ь"] = "я" .. a, ["ъ"] = "я" .. b
}

function export.makeSortKey(text, lang, sc)
	text = mw.ustring.gsub(mw.ustring.lower(text), "и", "и" .. b) -- ensure "и" comes after "і" and "ї"
	
	return mw.ustring.upper(mw.ustring.gsub(text, ".", oneChar))
end

return export