Module:xchc-translit: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 55: Line 55:
["[Ъъ]"]="'",
["[Ъъ]"]="'",
["[" .. D .. A .. "]*"] = DA, [M .. B] = DA, [M] = A,
["[" .. D .. A .. "]+"] = DA, [M .. B] = DA, [M] = A,
["É" .. D] = "E" .. DA, ["é" .. D] = "e" .. DA,
["É" .. D] = "E" .. DA, ["é" .. D] = "e" .. DA,

Revision as of 21:54, 7 October 2023



local u = mw.ustring.char
local M = u(0x0304) -- COMBINING MACRON
local B = u(0x0306) -- COMBINING BREVE
local D = u(0x0308) -- COMBINING DIAERESIS
local A = u(0x0301) -- COMBINING ACUTE
local DA = u(0x030B) -- COMBINING DOUBLE ACUTE

local export = {}

local tt_lepik = {
	[M .. B] = DA, [M] = A, [B] = D,
	
	["Е" .. D]='Yo', ["е" .. D]='yo',
	--["О" .. B]='A' .. D, ["о" .. B]='a' .. D,
	--["О" .. M .. B]='A' .. DA, ["о" .. M .. B]='a' .. DA,
	--["Э" .. B]='E' .. D, ["э" .. B]='e' .. D,
	--["Э" .. M .. B]='E' .. DA, ["э" .. M .. B]='e' .. DA,
	--["Ү" .. M]='U' .. DA, ["ү" .. M]='u' .. DA,
	["Ү"]='U' .. D, ["ү"]='u' .. D,
	["Ө"]='O' .. D, ["ө"]='o' .. D,
	--["Ө" .. M]='O' .. DA, ["ө" .. M]='o' .. DA,
	["[ЬІ]"]="Y", ["[ьі]"]="y",
	["Э"]='E', ["э"]='e',
	["О"]='O', ["о"]='o',
	["А"]='A', ["а"]='a',
	["Б"]='B', ["б"]='b',
	["В"]='V', ["в"]='v',
	["Г"]='G', ["г"]='g',
	["Ғ"]='Gh', ["ғ"]='gh',
	["Дз"]='Dc', ["дз"]='dc', ["Дж"]='Dz', ["дж"]='dz',
	["Д"]='D', ["д"]='d',
	["Е"]='Ye', ["е"]='ye',
	["Ж"]='Ž', ["ж"]='ž',
	["З"]='Z', ["з"]='z', 
	["И"]='Yi', ["и"]='yi', ["Й"]='j', ["й"]='j',
	["К"]='K', ["к"]='k',
	["Л"]='L', ["л"]='l',
	["М"]='M', ["м"]='m',
	["Н"]='N', ["н"]='n',
	["Ӈ"]='Ng', ["ӈ"]='ng',
	["О"]='O', ["о"]='o',
	["П"]='P', ["п"]='p',
	["Р"]='R', ["р"]='r',
	["С"]='S', ["с"]='s',
	["Т"]='T', ["т"]='t',
	["У"]='U', ["у"]='u',
	["Ф"]='F', ["ф"]='f',
	["ХӀ"]='H', ["хӀ"]='h', ["Х"]='Ch', ["х"]='ch',
	["Ц"]='C', ["ц"]='c',
	["Ч"]='Cs', ["ч"]='cs',
	["Ш"]='Š', ["ш"]='š',
	["Ы"]='I', ["ы"]='i',
	["Ю"]='Yu', ["ю"]='yu',
	["Я"]='Ya', ["я"]='ya',
	["[Ъъ]"]="'",
	
	["[" .. D .. A .. "]+"] = DA, [M .. B] = DA, [M] = A,
	
	["É" .. D] = "E" .. DA, ["é" .. D] = "e" .. DA,
};

function export.tr(text, lang, sc)
	
	for pat, repl in pairs(tt_lepik) do
		text = mw.ustring.gsub(mw.ustring.toNFD(text), pat, repl)
	end
	return text
end

return export