Module:uby-sortkey

Hello, you have come here looking for the meaning of the word Module:uby-sortkey. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:uby-sortkey, but we will also tell you about its etymology, its characteristics and you will know how to say Module:uby-sortkey in singular and plural. Everything you need to know about the word Module:uby-sortkey you have here. The definition of the word Module:uby-sortkey will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:uby-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, e, f, g, h, i, j, k, l, m, n, o = u(0xF000), u(0xF001), u(0xF002), u(0xF003), u(0xF004), u(0xF005), u(0xF006), u(0xF007), u(0xF008), u(0xF009), u(0xF00A), u(0xF00B), u(0xF00C), u(0xF00D), u(0xF00E)

local oneChar = {
	 = "г" .. c,  = "г" .. d,  = "е" .. a,  = "з" .. b,  = "з" .. d,  = "к" .. c,  = "к" .. f,  = "к" .. k,  = "л" .. a,  = "п" .. b,  = "п" .. c,  = "с" .. b,  = "т" .. b,  = "х" .. e,  = "ц" .. d,  = "ч" .. a,  = "ч" .. b,  = "ч" .. c,  = "ы" .. a,  = "ы" .. b,  = "ь" .. a
}

local twoChars = {
	 = "б" .. a,  = "в" .. a,  = "г" .. a,  = "г" .. b,  = "г" .. e,  = "г" .. f,  = "г" .. g,  = "г" .. h,  = "г" .. i,  = "г" .. j,  = "д" .. a,  = "ж" .. a,  = "ж" .. b,  = "з" .. a,  = "з" .. c,  = "з" .. e,  = "з" .. f,  = "з" .. g,  = "к" .. a,  = "к" .. b,  = "к" .. d,  = "к" .. e,  = "к" .. g,  = "к" .. h,  = "к" .. i,  = "к" .. l,  = "к" .. m,  = "к" .. n,  = "л" .. b,  = "м" .. a,  = "п" .. a,  = "п" .. d,  = "п" .. e,  = "с" .. a,  = "с" .. c,  = "т" .. a,  = "т" .. c,  = "ф" .. a,  = "х" .. a,  = "х" .. b,  = "х" .. c,  = "х" .. f,  = "ц" .. a,  = "ц" .. b,  = "ц" .. c,  = "ц" .. e,  = "ц" .. f,  = "ц" .. g,  = "ш" .. a,  = "ш" .. b,  = "ы" .. c
}

local threeChars = {
	 = "г" .. k,  = "г" .. l,  = "к" .. j,  = "к" .. o,  = "х" .. d
}

function export.makeSortKey(text, lang, sc)
	text = mw.ustring.lower(text)
	
	for from, to in pairs(threeChars) do
		text = mw.ustring.gsub(text, from, to)
	end
	
	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