Module:mrj-sortkey

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

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

local oneChar = {
	["ӓ"] = "а" .. a, ["ё"] = "е" .. a, ["ӧ"] = "о" .. a, ["ӱ"] = "у" .. a, ["ӹ"] = "ы" .. a
}

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

return export