Module:Mymr-sortkey

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

This is UCA-like sortkey module using PUA to rearrange. It focuses on Myanmar (Burmese) script that is disorderedly used by many languages.


local export = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local find = mw.ustring.find
local sub = mw.ustring.sub

local glyphTable = {

	 = u(0xE000),  = u(0xE001),  = u(0xE002),

	 = u(0xE010),  = u(0xE011),  = u(0xE012),  = u(0xE013),
	 = u(0xE014),  = u(0xE015),  = u(0xE016),  = u(0xE017),
	 = u(0xE018),  = u(0xE019),  = u(0xE01A),  = u(0xE01B),  = u(0xE01C),

	 = u(0xE020),  = u(0xE021),  = u(0xE022),  = u(0xE023),  = u(0xE024),  = u(0xE025),
	 = u(0xE026),  = u(0xE027),  = u(0xE028),  = u(0xE029),  = u(0xE02A),  = u(0xE02B),
	 = u(0xE02C),  = u(0xE02D),  = u(0xE02E),  = u(0xE02F),  = u(0xE030),  = u(0xE031),
	 = u(0xE032),  = u(0xE033),  = u(0xE034),  = u(0xE035),  = u(0xE036),  = u(0xE037),
	 = u(0xE038),  = u(0xE039),  = u(0xE03A),  = u(0xE03B),  = u(0xE03C),  = u(0xE03D),

	 = u(0xE040),  = u(0xE041),  = u(0xE042),  = u(0xE043),
	 = u(0xE044),  = u(0xE045),  = u(0xE046),  = u(0xE047),
	 = u(0xE048),  = u(0xE049),  = u(0xE04A),  = u(0xE04B),  = u(0xE04C),

	 = u(0xE050),  = u(0xE051),  = u(0xE052),
	 = u(0xE053),  = u(0xE054),  = u(0xE055),  = u(0xE056),
	 = u(0xE057),  = u(0xE058),  = u(0xE059),  = u(0xE05A),  = u(0xE05B),
	 = u(0xE05C),  = u(0xE05D),  = u(0xE05E),  = u(0xE05F),  = u(0xE060),
	 = u(0xE061),  = u(0xE062),
	 = u(0xE063),  = u(0xE064),  = u(0xE065),  = u(0xE066),  = u(0xE067),

	 = u(0xE070),  = u(0xE071),  = u(0xE072),  = u(0xE073),
	 = u(0xE074),  = u(0xE075),  = u(0xE076),  = u(0xE077),  = u(0xE078),  = u(0xE079),
	 = u(0xE07A),  = u(0xE07B),  = u(0xE07C),  = u(0xE07D),

	 = u(0xE080),  = u(0xE081),  = u(0xE082),  = u(0xE083),  = u(0xE084),
	 = u(0xE085),  = u(0xE086),  = u(0xE087),
	 = u(0xE088),  = u(0xE089),  = u(0xE08A),  = u(0xE08B),

	 = u(0xE090),  = u(0xE091),  = u(0xE092),
	 = u(0xE093),  = u(0xE094),  = u(0xE095),  = u(0xE096),
	 = u(0xE097),  = u(0xE098),  = u(0xE099),
	 = u(0xE09A),  = u(0xE09B),  = u(0xE09C),  = u(0xE09D),  = u(0xE09E),

	 = u(0xE0A0),  = u(0xE0A1),  = u(0xE0A2),  = u(0xE0A3),  = u(0xE0A4),  = u(0xE0A5),
	 = u(0xE0A6),  = u(0xE0A7),  = u(0xE0A8),  = u(0xE0A9),  = u(0xE0AA),

	 = u(0xE0B0),  = u(0xE0B1),  = u(0xE0B2),  = u(0xE0B3),  = u(0xE0B4),  = u(0xE0B5),
	 = u(0xE0B6),  = u(0xE0B7),  = u(0xE0B8),  = u(0xE0B9),  = u(0xE0BA),  = u(0xE0BB),
	 = u(0xE0BC),  = u(0xE0BD),  = u(0xE0BE),  = u(0xE0BF),
	 = u(0xE0C0),  = u(0xE0C1),  = u(0xE0C2),

	 = u(0xE0D0),  = u(0xE0D1),  = u(0xE0D2),  = u(0xE0D3),  = u(0xE0D4),  = u(0xE0D5),
	 = u(0xE0D6),  = u(0xE0D7),  = u(0xE0D8),  = u(0xE0D9),
	 = u(0xE0DA),  = u(0xE0DB),  = u(0xE0DC),  = u(0xE0DD),

	 = u(0xE0E0),  = u(0xE0E1),  = u(0xE0E2),  = u(0xE0E3),  = u(0xE0E4),
	 = u(0xE0E5),  = u(0xE0E6),  = u(0xE0E7),  = u(0xE0E8),
	 = u(0xE0E9),  = u(0xE0EA),  = u(0xE0EB),  = u(0xE0EC),

	 = u(0xE0F0),  = u(0xE0F1),  = u(0xE0F2),  = u(0xE0F3),
	 = u(0xE0F4),  = u(0xE0F5),  = u(0xE0F6),  = u(0xE0F7),
	 = u(0xE0F8),  = u(0xE0F9),  = u(0xE0FA),
	 = u(0xE0FB),  = u(0xE0FC),  = u(0xE0FD),  = u(0xE0FE),

	 = u(0xE100),  = u(0xE101),  = u(0xE102),  = u(0xE103),  = u(0xE104),
	 = u(0xE105),  = u(0xE106),  = u(0xE107),  = u(0xE108),  = u(0xE109),
	 = u(0xE10A),  = u(0xE10B),  = u(0xE10C),  = u(0xE10D),  = u(0xE10E),
	 = u(0xE10F),  = u(0xE110),  = u(0xE111),  = u(0xE112),  = u(0xE113),
	 = u(0xE114),  = u(0xE115),  = u(0xE116),  = u(0xE117),  = u(0xE118),  = u(0xE119),

}

function export.makeSortKey(text, lang, sc)

	if sc and sc ~= "Mymr" then
		return mw.ustring.upper(text)
	end
	
	if not text then
		return nil
	end

	text = gsub(text, "ဥ".."ီ", "ဦ")
	text = gsub(text, "ဿ", "သ္သ")

	if lang == "shn" or lang == "tjl" or lang == "kht" then
		text = gsub(text, "ၢ", u(0xE0E3)) -- vowel aa with final
	end

	text = gsub(text, ".", glyphTable)

	return text

end

function export.showSorting(frame)

	local terms = {}
	
	for _, term in ipairs(frame.args) do
		table.insert(terms, term)
	end
	
	local makeSortKey = require("Module:fun").memoize(export.makeSortKey)
	local function comp(term1, term2)
		return makeSortKey(term1) < makeSortKey(term2)
	end
	
	table.sort(terms, comp)
	
	for i, term in pairs(terms) do
		terms = "\n* " .. term .. " (<code>" .. makeSortKey(term) .. "</code>)"
	end
	
	return table.concat(terms)

end

return export