This module will transliterate Komi-Zyrian language text per WT:KPV TR. It is also used to transliterate Komi-Permyak, Komi-Zyrian, and Komi-Yazva.
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:kv-translit/testcases.
tr(text, lang, sc)
text
written in the script specified by the code sc
, and language specified by the code lang
.nil
.It will also transliterate koi.
local export = {}
local tab = {
="A", ="B", ="V", ="G", ="D", ="E", ="O", ="Ž", ="Z", ="I", ="I", ="J",
="K", ="L", ="M", ="N", ="O", ="Ö", ="P", ="R", ="S", ="T", ="U", ="F",
="X", ="C", ="Ć", ="Š", ="Šč", ="", ="Y", ="", ="E", ="U", ="A",
='a', ='b', ='v', ='g', ='d', ='e', ='o', ='ž', ='z', ='i', ='i', ='j',
='k', ='l', ='m', ='n', ='o', ='ö', ='p', ='r', ='s', ='t', ='u', ='f',
='x', ='c', ='ć', ='š', ='šč', ='', ='y', ='', ='e', ='u', ='a', ='Å',
='å', ='Ü', ='ü',
}
function export.tr(text, lang, sc)
local language = lang
-- Ё needs converting if is decomposed
text = text:gsub("ё","ё"):gsub("Ё","Ё")
-- тш
text = mw.ustring.gsub(text, "Тш", "Č")
text = mw.ustring.gsub(text, "тш", "č")
-- soft consonants
text = mw.ustring.gsub(text, "()з", "%1зQ")
text = mw.ustring.gsub(text, "()()", "%1Q%2")
-- geminates
text = mw.ustring.gsub(text, "()()()", "%1Q%2Q%3")
if lang ~= "kpv" then
text = mw.ustring.gsub(text, "()()", "%1Q%2")
end
-- soft vowels after a vowel or at the beginning of a word become j-
text = mw.ustring.gsub(text, "(?)()", "%1j%2")
text = mw.ustring.gsub(text, "^Е", "Jе")
text = mw.ustring.gsub(text, "^Ё", "Jё")
text = mw.ustring.gsub(text, "^Ю", "Jю")
text = mw.ustring.gsub(text, "^Я", "jя")
text = mw.ustring.gsub(text, "^()", "j%1")
-- palatalisation
text = mw.ustring.gsub(text, "ДQ", "Ď")
text = mw.ustring.gsub(text, "дQ", "ď")
text = mw.ustring.gsub(text, "ЗQ", "Ź")
text = mw.ustring.gsub(text, "зQ", "ź")
text = mw.ustring.gsub(text, "ЛQ", "Ľ")
text = mw.ustring.gsub(text, "лQ", "ľ")
text = mw.ustring.gsub(text, "НQ", "Ń")
text = mw.ustring.gsub(text, "нQ", "ń")
text = mw.ustring.gsub(text, "СQ", "Ś")
text = mw.ustring.gsub(text, "сQ", "ś")
text = mw.ustring.gsub(text, "ТQ", "Ť")
text = mw.ustring.gsub(text, "тQ", "ť")
text = mw.ustring.gsub(text, "Q", "ʹ")
return (mw.ustring.gsub(text,'.',tab))
end
return export