Module:zza-sortkey: Difference between revisions

From Linguifex
Jump to navigation Jump to search
m Protected "Module:zza-sortkey": (bot) automatically protect highly visible templates/modules (reference score: 1710+ >= 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

Lua error in package.lua at line 80: module 'Module:languages/bySortkeyModule' not found.

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

local oneChar = {
	["ç"] = "c" .. a, ["ê"] = "e" .. a, ["ğ"] = "g" .. a, ["ı"] = "i", ["î"] = "i" .. b, ["ş"] = "s" .. a, ["û"] = "u" .. a
}

function export.makeSortKey(text, lang, sc)
	text = mw.ustring.gsub(mw.ustring.lower(mw.ustring.gsub(text, "I", "ı")), "i", "i" .. a) -- ensure "i" comes after "ı"
	
	return mw.ustring.upper(mw.ustring.gsub(text, ".", oneChar))
end

return export