Module:smn-sortkey

From Linguifex
Revision as of 12:00, 21 April 2026 by Sware (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:smn-sortkey/doc

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

local oneChar = {
	["â"] = "a" .. a, ["č"] = "c" .. a, ["đ"] = "d" .. a, ["ŋ"] = "n" .. a, ["š"] = "s" .. 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