local export = {}
local tab = {
="A", ="B", ="V", ="G", ="D", ="E", ="Yo", ="Ž", ="Z", ="I", ="Y", ="J̌", ="J̌]",
="K", ="L", ="M", ="N", ="Ŋ", ="O", ="Ö", ="Ö]", ="P", ="R", ="S", ="T",
="U", ="Ü", ="F", ="H", ="C", ="Č", ="Š", ="Šč", ="ʺ", ="Ï", ="ʹ",
="E", ="Yu", ="Ya",
='a', ='b', ='v', ='g', ='d', ='e', ='yo', ='ž', ='z', ='i', ='y', ="ǰ", ="ǰ]",
='k', ='l', ='m', ='n', ='ŋ', ='o', ='ö', ='ö]', ='p', ='r', ='s', ='t',
='u', ='ü', ='f',
='h', ='c', ='č', ='š', ='šč', ='ʺ', ='ï', ='ʹ', ='e', ='yu', ='ya',
}
local iotated = {
= "Ye",
= "ye",
}
function export.tr(text, lang, sc)
local ugsub = mw.ustring.gsub
-- Ё needs to be composed if is decomposed (e + combining diaeresis).
-- However, this cannot happen in wikitext, only in Lua modules.
text = mw.ustring.toNFC(text)
-- е after a vowel or at the beginning of a word becomes ye
-- Note that according to modern Altai orthography ее (instead of ээ) is occationally used for long r
text = ugsub(text, "(?)е", "%1ye")
--text = mw.ustring.gsub(text, "(?)е", "%1ye")
text = ugsub(text, "^", iotated)
text = ugsub(text, "()()", function(a, b)
return a .. iotated
end)
return (ugsub(text, '.', tab))
end
return export