Pumunta sa nilalaman

Module:yi-translit

Mula Wiktionary

Ang dokumentasyon ng ng modyul na ito ay maaaring likhain sa Module:yi-translit/doc

local export = {}
local u = mw.ustring.char
 
local tt = {
	['א'] = '\'',
	['בּ'] = 'b', ['ב'] = 'v',
	['גּ'] = 'g', ['ג'] = 'g', ['גּ׳'] = 'j', ['ג׳'] = 'j',
	['דּ'] = 'd', ['ד'] = 'd', ['ד׳'] = 'dh',
	['ה'] = 'h', ['הּ'] = 'h',
	['ו'] = 'v', ['וּ'] = '(u/v)', ['וֹ'] = 'o', ['ו׳'] = 'w',
	['ז'] = 'z', ['ז׳'] = 'zh',
	['ח'] = 'kh',
	['ט'] = 't',
	['י'] = 'y',
	['כּ'] = 'k', ['כ'] = 'kh', ['ךּ'] = 'k', ['ך'] = 'kh',
	['ל'] = 'l',
	['מ'] = 'm', ['ם'] = 'm',
	['נ'] = 'n', ['ן'] = 'n',
	['ס'] = 's',
	['ע'] = '\'',
	['פּ'] = 'p', ['פ'] = 'f', ['ף'] = 'f',
	['צ'] = 'ts', ['ץ'] = 'ts', ['צ׳'] = 'ch', ['ץ׳'] = 'ch',
	['ק'] = 'k',
	['ר'] = 'r',
	['ש'] = '(s/sh)', ['שׁ'] = 'sh', ['שׂ'] = 's',
	['תּ'] = 't', ['ת'] = 't', ['ת׳'] = 'th',

	[u(0x05B0)] = '\'', -- HEBREW POINT SHEVA
	[u(0x05B1)] = 'e', -- HEBREW POINT HATAF SEGOL
	[u(0x05B2)] = 'a', -- HEBREW POINT HATAF PATAH
	[u(0x05B3)] = 'o', -- HEBREW POINT HATAF QAMATS
	[u(0x05B4)] = 'i', -- HEBREW POINT HIRIQ
	[u(0x05B5)] = 'ei', -- HEBREW POINT TSERE
	[u(0x05B6)] = 'e', -- HEBREW POINT SEGOL
	[u(0x05B7)] = 'a', -- HEBREW POINT PATAH
	[u(0x05B8)] = '(a/o)', -- HEBREW POINT QAMATS
	[u(0x05C7)] = 'o', -- HEBREW POINT QAMATS QATAN
	[u(0x05B9)] = 'o', -- HEBREW POINT HOLAM

	[u(0x05BB)] = 'u', -- HEBREW POINT QUBUTS
	[u(0x05BC)] = '', -- HEBREW POINT DAGESH OR MAPIQ

	[u(0x05C1)] = '', -- HEBREW POINT SHIN DOT
	[u(0x05C2)] = '', -- HEBREW POINT SIN DOT

	--
	['־'] = '-', -- HEBREW PUNCTUATION MAQAF
	['׳'] = '′', -- HEBREW PUNCTUATION GERESH
	['״'] = '″', -- HEBREW PUNCTUATION GERSHAYIM
}

function export.tr(text, lang, sc)
	text = text:gsub('חַ$','akh'):gsub('חַ(%s)','akh%1')
	text = text:gsub('עַ$','a\''):gsub('עַ(%s)','a\'%1')
	text = text:gsub('הַּ$','ah'):gsub('הַּ(%s)','ah%1')
	text = mw.ustring.gsub(text, '(['..u(0x05B0)..'-'..u(0x05B8)..u(0x05BB)..u(0x05C7)..'])(['..u(0x05B9)..u(0x05BC)..u(0x05C1)..u(0x05C2)..']+)', '%2%1')
	text = mw.ustring.gsub(text, '(['..u(0x05BC)..'])(['..u(0x05C1)..u(0x05C2)..'])', '%2%1')
	text = mw.ustring.gsub(text, '.['..u(0x05B9)..u(0x05BC)..u(0x05C1)..u(0x05C2)..'׳]', tt)
	text = mw.ustring.gsub(text, '.', tt)

	return text
end

return export