--[[
Transliteration for Hebrew.
]]
local M={}
 
local tt={
    ["א"]="'", 
    ["ע"]="'",
    ["בּ"]='b', ["ב"]='v',
    ["ג"]='g', ["ד"]='d', ["ה"]='h', ["ו"]='v', ["ז"]='z', ["ח"]='kh', ["ט"]='t',
    ["י"]='y', ["כ"]='ch', ["ך"]='ch', ["ל"]='l', ["מ"]='m', ["ם"]='m', ["נ"]='n', ["ן"]='n', 
    ["ס"]='s', ["פ"]='f', ["ף"]='f', ["צ"]='ts', ["ץ"]='ts', ["ק"]='k', 
    ["ר"]='r', ["ש"]='(s/sh)', ["שׂ"]='s',  ["שׁ"]='sh',
    ["ת"]='t', 
    ["וּ"]='(u/v)', ["וֹ"]="o",
    ["פּ"]="p", ["ףּ"]="p",
    ["כּ"]='k', ["ךּ"]='k', 
    --
    ["ְ"]="'", -- sh'va
    ["ֱ"]="e", 
    ["ֲ"]="a", 
    ["ֳ"]="o", 
    ["ִ"]="i", 
    ["ֵ"]="ei", 
    ["ָ"]="(a/o)",
    ["ֶ"]="e", 
    ["ַ"]="a",
    ["ׂ"]="", 
    ["ׁ"]="", 
    ["ֻ"]="u", 
    ["ּ"]="", 
    ["ֹ"]="o",
    
};
function M.tr(f)--translit any words or phrases
    local text = f.args[1]
    text = text:gsub("חַ$","ach"):gsub("חַ(%s)","ach%1")
    text = text:gsub("עַ$","a'"):gsub("עַַ(%s)","a'%1")
    text = mw.ustring.gsub(text, '([ְֱֲֳִֵֶַָֻ])([ֹּׁׂ])', "%2%1")
    text = mw.ustring.gsub(text, '.[ֹּׁׂ]', tt)
    text = mw.ustring.gsub(text, '.', tt)
    return text
end

return M