This module will transliterate Shor language text per WT:CJS TR.
The module should preferably not be called directly from templates or other modules.
To use it from a template, use {{xlit}}
.
Within a module, use Module:languages#Language:transliterate.
For testcases, see Module:cjs-translit/testcases.
tr(text, lang, sc)
text
written in the script specified by the code sc
, and language specified by the code lang
.nil
.local export = {}
local tab = {
="A", ="B", ="V", ="G", ="Ĝ", ="D", ="E", ="Yo", ="Ž", ="Z", ="I", ="Y", ="J̌]", ="J̌]]",
="K", ="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', ='k̂', ='l', ='m', ='n', ='ŋ', ='ŋ]', ='o', ='ö', ='ö]', ='p', ='r', ='s', ='t',
='u', ='ü', ='f',
='h', ='c', ='č', ='š', ='šč', ='ʺ', ='ï', ='ʹ', ='e', ='yu', ='ya',
}
function export.tr(text, lang, sc)
-- Ё needs converting if is decomposed
text = text:gsub("ё","ё"):gsub("Ё","Ё")
-- е after a vowel or at the beginning of a word becomes ye
-- Note that according to modern Shor orthography ее (instead of ээ) is occationally used for long e
text = mw.ustring.gsub(text, "(?)е","%1ye")
--text = mw.ustring.gsub(text, "(?)е","%1ye")
text = mw.ustring.gsub(text, "^Е","Ye")
text = mw.ustring.gsub(text, "^е","ye")
text = mw.ustring.gsub(text, "()Е","%1Ye")
text = mw.ustring.gsub(text, "()е","%1ye")
return (mw.ustring.gsub(text,'.',tab))
end
return export