Documentation for this module may be created at မဝ်ဂျူ:Hebr-Arab-translit/doc

local export = {}
local gsub = mw.ustring.gsub
local match = mw.ustring.match

local letters = "קראטוןםפףךלחיעכגדשזסבהנמצתץ"
local dagesh = "ּ"
local diacritics = "ְֱֲֲֳִֵֶַָָֻּ"

local tt = {
	['ב']='ب',  ['ג']='ج',['דּ']='د',['ד']='ذ',['ה']='ه',['ו']='و',['ז']='ز',	['ח']='ح',['ט']='ط',['י']='ي',
	['כּ']='ك', -- intital form
	['כ']='ك', -- intial form 
	['ךּ']='ك', -- final form, with dagesh = strong k sound
	['ך']='ك', -- final form
	['ל']='ل',['מ']='م',['ם']='م',['נ']='ن',['ן']='ن',
	['ס']='س', -- no direct equivalent
	['ע']='ع',['פ']='ف',['ף']='ف',['צ']='ص',['ץ']='ص',['ק']='ق',['ר']='ر',['שׁ']='ش',['שׂ']='س',['ש']='ش',
	['ת']='ث',
	['א']='أ',
	
	['ַ']='َ',-- Patach/fatah
	['ִ']='ِ', -- Hiriq/Damma
	['ָ']='ٰ', -- Qamatz/Khanjariyah
	['ְ']='ْ',-- Shva/Sukun
	['ֹ']='و'-- Holam
}
function export.tr(text, lang, sc)

	-- fixes the double diacritic issues
	
    text = gsub(text, "פ" .. '([' .. diacritics .. '])' .. dagesh, "ف%1")
    
	text = mw.ustring.gsub(text, '([\214\176\214\177\214\178\214\179\214\180\214\181\214\182\214\183\214\184\214\187])([\214\185\214\188\215\129\215\130])', "%2%1")
	text = mw.ustring.gsub(text, '.[\214\185\214\188\215\129\215\130]', tt)
	--
	
	text = gsub(text, "תּ","ت")
	text = gsub(text, "וֹ","و")
	text = gsub(text, "וּ","ُو")
		
	text = mw.ustring.gsub(text, '.', tt)

	return text
end
return export