Module:tab-sortkey

Hello, you have come here looking for the meaning of the word Module:tab-sortkey. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:tab-sortkey, but we will also tell you about its etymology, its characteristics and you will know how to say Module:tab-sortkey in singular and plural. Everything you need to know about the word Module:tab-sortkey you have here. The definition of the word Module:tab-sortkey will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:tab-sortkey, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


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

local oneChar = {
	 = "е" .. a
}

local twoChars = {
	 = "а" .. a,  = "г" .. a,  = "г" .. b,  = "г" .. c,  = "ж" .. a,  = "к" .. a,  = "к" .. b,  = "к" .. c,  = "к" .. d,  = "п" .. a,  = "п" .. b,  = "т" .. a,  = "т" .. b,  = "у" .. a,  = "х" .. a,  = "х" .. b,  = "ц" .. a,  = "ц" .. b,  = "ч" .. a,  = "ч" .. b,  = "ч" .. c,  = "ш" .. a
}

function export.makeSortKey(text, lang, sc)
	text = mw.ustring.lower(text)
	
	for from, to in pairs(twoChars) do
		text = mw.ustring.gsub(text, from, to)
	end
	
	return mw.ustring.upper(mw.ustring.gsub(text, ".", oneChar))
end

return export