Module:ota-Armn-translit

local export = {} -- Used to transliterate the Armeno-Turkish alphabet local gsub = require("Module:string utilities").gsub

local mapping = { ["ա"]="a", ["գ"]="k", ["ե"]="y", ["զ"]="z", ["է"]="e", ["ը"]="ı", ["թ"]="t", ["ժ"]="j", ["ի"]="i", ["լ"]="l", ["խ"]="h", ["կ"]="g", ["հ"]="h", ["ղ"]="ğ", ["ճ"]="c", ["մ"]="m", ["յ"]="y", ["ն"]="n", ["շ"]="ş", ["չ"]="ç", ["պ"]="b", ["ս"]="s", ["վ"]="v", ["տ"]="d", ["ր"]="r", ["փ"]="p", ["ք"]="k", ["և"]="ew", ["օ"]="o", ["ֆ"]="f", ["Ա"]="A", ["Գ"]="K", ["Ե"]="Y", ["Զ"]="Z", ["Է"]="E", ["Ը"]="I", ["Թ"]="T", ["Ժ"]="J", ["Ի"]="İ", ["Լ"]="L", ["Խ"]="H", ["Կ"]="G", ["Հ"]="H", ["Ղ"]="Ğ", ["Ճ"]="C", ["Մ"]="M", ["Յ"]="Y", ["Ն"]="N", ["Շ"]="Ş", ["Չ"]="Ç", ["Պ"]="B", ["Ս"]="S", ["Վ"]="V", ["Տ"]="D", ["Ր"]="R", ["Փ"]="P", ["Ք"]="K", ["Օ"]="O", ["Ֆ"]="F", -- turning RIGHT SINGLE QUOTATION MARK (U+2019) into MODIFIER LETTER APOSTROPHE (U+02BC) -- the encoding ARMENIAN APOSTROPHE (U+055A) is dispreferred by the Unicode standard ["’"]="ʼ", -- not used in Turkish words ["բ"]="p", ["դ"]="t", ["ծ"]="dz", ["ձ"]="ts", ["ջ"]="ç", ["ռ"]="r", ["ց"]="ts", ["Բ"]="P", ["Դ"]="T", ["Ծ"]="Dz", ["Ձ"]="Ts", ["Ջ"]="Ç", ["Ռ"]="R", ["Ց"]="Ts", -- punctuation ["՝"]=",", ["։"]=".", ["․"]=";", ["՛"]="́", ["՜"]="!", ["՞"]="?",	["՟"]=".", ["֊"]="-", ['«']='“', ['»']='”', }

local replacements = { ['([ՔԿ])ԵԱ'] = '%1Â', ['([ՔքԿկ])եա'] = '%1â', -- լեա is lya ['Ո[ւՒ]'] = 'U', ['ու'] = 'u', ['Ի[ւՒ]'] = 'Ü', ['իւ'] = 'ü', ['Է[օՕ]'] = 'Ö', ['էօ'] = 'ö', ['Ո՛[ւՒ]'] = 'Ú', ['ո՛ւ'] = 'ú', ['Ո՜[ւՒ]'] = 'U!', ['ո՜ւ'] = 'u!', ['Ո՞[ւՒ]'] = 'U?', ['ո՞ւ'] = 'u?', -- ['Ն[ԿՂ]'] = 'Ñ', these cannot be handled automatically -- ['ն[կղ]'] = 'ñ', these cannot be handled automatically }

function export.tr(text, lang, sc) if sc and sc ~= "Armn" then return nil end

for regex, replacement in pairs(replacements) do		text = gsub(text, regex, replacement) end

text = gsub(text, '.', mapping) return text end

return export