Module:sje-sortkey: Difference between revisions

From Linguifex
Jump to navigation Jump to search
m Protected "Module:sje-sortkey": (bot) automatically protect highly visible templates/modules (reference score: 1060+ >= 1000) ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))
 
m 1 revision imported
 
(No difference)

Latest revision as of 12:00, 21 April 2026



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

local oneChar = {
	["á"] = "a" .. a, ["đ"] = "d" .. a, ["ŋ"] = "n" .. a, ["ŧ"] = "t" .. a, ["å"] = "z" .. a, ["ä"] = "z" .. b
}

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

return export