Bước tới nội dung

Mô đun:sms-sortkey

Từ điển mở Wiktionary
local export = {}
local u = mw.ustring.char
local a, b, c = u(0xF000), u(0xF001), u(0xF002)

local oneChar = {
	["â"] = "a" .. a, ["č"] = "c" .. a, ["ʒ"] = "c" .. b, ["ǯ"] = "c" .. c, ["đ"] = "d" .. a, ["ǧ"] = "g" .. a, ["ǥ"] = "g" .. b, ["ǩ"] = "k" .. a, ["ŋ"] = "n" .. a, ["õ"] = "o" .. 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