This module will transliterate Ossetian language text per WT:OS 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:os-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 mapping1 = {
="æ" ,='Æ' , ="t" ,='T' , ="r" ,='R' , ="f",='F', ="è",='È',
="ju",='Ju', ="š" ,='Š' , ="ʹ" ,='ʹ' , ="ʺ",='ʺ', ="n",='N',
="p" ,='P' , ="j" ,='J' , ="l" ,='L' , ="z",='Z', ="e",='E',
="g" ,='G' , ="b" ,='B' , ="u" ,='U' , ="s",='S', ="x",='X',
="ḱ" ,='Ḱ' , ="šč",='ŠČ', ="ja",='Ja', ="y",='Y', ="è",='È',
="m" ,='M' , ="o" ,='O' , ="i" ,='I' , ="ë",='Ë', ="ž",='Ž',
="k" ,='K' , ="d" ,='D' , ="v" ,='V' , ="c",='C', ="a",='A'
}
local mapping2 = {
= 'k’', = 'K’', = 'p’', = 'P’',
= 't’', = 'T’', = 'c’', = 'C’',
= 'ḱ’', = 'Ḱ’', = 'q' , = 'Q',
= 'ǧ' , = 'Ǧ' , = 'ǵ' , = 'Ǵ',
= 'ʒ' , = 'Ʒ' , = 'aw', = 'Aw',
= 'æw', = 'Æw', = 'iw', = 'Iw',
= 'yw', = 'Yw', = 'ew', = 'Ew',
= 'wa', = 'Wa', = 'wæ', = 'Wæ',
= 'wi', = 'Wi', = 'wy', = 'Wy',
= 'we', = 'We',
}
local mapping3 = {
= 'g°y', = 'G°y',
= 'k°y', = 'K°y',
= 'x°y', = 'X°y',
}
function export.tr(text, lang, sc)
if sc ~= "Cyrl" then return nil end
text = mw.ustring.gsub(text, 'къуы', 'k’°y')
text = mw.ustring.gsub(text, 'Kъуы', 'K’°y')
for pat, repl in pairs(mapping3) do
text = mw.ustring.gsub(text, pat, repl)
end
for pat, repl in pairs(mapping2) do
text = mw.ustring.gsub(text, pat, repl)
end
text = mw.ustring.gsub(text, '.', mapping1)
return text
end
return export