This module will transliterate Kildin Sami language text.
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:sjd-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 u = mw.ustring.char
local macron = u(0x0304)
local tt = {
='A', ='a',
="’a", ="’a",
='B', ='b',
='V', ='v',
='G', ='g',
='D', ='d',
='Je', ='je',
="Jo", ="jo",
='Ž', ='ž',
='Z', ='z',
="H", ="h", ="h",
='I', ='i',
="Ī", ="ī",
="J", ="j",
="J̥", ="j̥", ="J̥", ="j̥",
='K', ='k',
='L', ='l',
='L̥', ='l̥',
='M', ='m',
="M̥", ="m̥",
='N', ='n',
="N̥", ="n̥",
="Ŋ", ="ŋ",
='O', ='o',
='P', ='p',
='R', ='r',
="R̥", ="r̥",
='S', ='s',
='T', ='t',
='U', ='u',
="Ū", ="ū",
='F', ='f',
='X', ='x',
='C', ='c',
='Č', ='č',
='Š', ='š',
="Šč", ="šč",
="Y", ="y",
="", ="",
="’", ="’", = "’", ="’",
="E", ="e",
="’E", ="’e",
="Ju", ="ju",
="Ja", ="ja",
}
local vowel = "аӓеёиӣоуӯыэӭюяАӒЕЁИӢОУӮЫЭӬЮЯ"
function export.tr(text, lang, sc)
-- digraphs ie and ea
text = mw.ustring.gsub(text, "()е" .. macron, "%1иэ")
text = mw.ustring.gsub(text, "()я" .. macron, "%1эа")
text = mw.ustring.gsub(text, "()Е" .. macron, "%1Иэ")
text = mw.ustring.gsub(text, "()Я" .. macron, "%1Эа")
-- initial j + vowels
text = mw.ustring.gsub(text, "^" .. "ю" .. macron, "jū")
text = mw.ustring.gsub(text, "^" .. "я" .. macron, "jea")
text = mw.ustring.gsub(text, "^" .. "ӣ", "ji")
text = mw.ustring.gsub(text, "^" .. "е" .. macron, "jie")
text = mw.ustring.gsub(text, "^" .. "Ю" .. macron, "Jū")
text = mw.ustring.gsub(text, "^" .. "Я" .. macron, "Jea")
text = mw.ustring.gsub(text, "^" .. "Ӣ", "Ji")
text = mw.ustring.gsub(text, "^" .. "Е" .. macron, "Jie")
text = mw.ustring.gsub(text, " " .. "ю" .. macron, " jū")
text = mw.ustring.gsub(text, " " .. "я" .. macron, " jea")
text = mw.ustring.gsub(text, " " .. "ӣ", " ji")
text = mw.ustring.gsub(text, " " .. "e" .. macron, " jie")
text = mw.ustring.gsub(text, " " .. "Ю" .. macron, " jū")
text = mw.ustring.gsub(text, " " .. "Я" .. macron, " jea")
text = mw.ustring.gsub(text, " " .. "Ӣ", " ji")
text = mw.ustring.gsub(text, " " .. "E" .. macron, " jie")
text = mw.ustring.gsub(text, "йе", "jje")
--palatal н
text = mw.ustring.gsub(text, "()е", "%1ьэ")
text = mw.ustring.gsub(text, "()ё", "%1ьо")
text = mw.ustring.gsub(text, "()ю", "%1ьу")
text = mw.ustring.gsub(text, "()я", "%1ьа")
text = mw.ustring.gsub(text, "()Е", "%1ЬЭ")
text = mw.ustring.gsub(text, "()Ё", "%1ЬО")
text = mw.ustring.gsub(text, "()Ю", "%1ЬУ")
text = mw.ustring.gsub(text, "()Я", "%1ЬА")
text = mw.ustring.gsub(text, "()ь", "%1й")
text = mw.ustring.gsub(text, "НЬ", "НЙ")
-- oa digraph
text = mw.ustring.gsub(text, "ОА" .. macron, "ÅÅ")
text = mw.ustring.gsub(text, "Оа" .. macron, "Åå")
text = mw.ustring.gsub(text, "оа" .. macron, "åå")
text = mw.ustring.gsub(text, "О", "Å")
text = mw.ustring.gsub(text, "оа", "å")
-- ёa digraph
text = mw.ustring.gsub(text, "ЁА" .. macron, "JÅÅ")
text = mw.ustring.gsub(text, "Ёа" .. macron, "Jåå")
text = mw.ustring.gsub(text, "ёа" .. macron, "jåå")
text = mw.ustring.gsub(text, "ЁА", "JÅ")
text = mw.ustring.gsub(text, "Ёа", "Jå")
text = mw.ustring.gsub(text, "ёа", "jå")
return (mw.ustring.gsub(text, '.', tt))
end
return export