This module will transliterate Cree language text. It is also used to transliterate Southern East Cree, Northern East Cree, and Inuktitut.
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:cr-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 = {}
function export.tr(text, lang, sc)
text = require("Module:Cans-translit").tr(text, lang, sc)
text = mw.ustring.gsub(text,"ī","ii")
text = mw.ustring.gsub(text,"ō","oo")
text = mw.ustring.gsub(text,"ā","aa")
text = mw.ustring.gsub(text,"š","sh")
text = mw.ustring.gsub(text,"ð","th")
return text
end
function export.transcribe(text)
local replace = {"sh","th","hk","kw","sk"}
local s = "ᐁᐃᐅᐊᐯᐱᐳᐸᑌᑎᑐᑕᑫᑭᑯᑲᒉᒋᒍᒐᒣᒥᒧᒪᓀᓂᓄᓇᓭᓯᓱᓴᔦᔨᔪᔭᖊᖋᖌᖍᕃᕆᕊᕍᔐᔑᔓᔕᕓᕕᕗᕙᘚᘛᘕᘔᓓᓕᓗᓚ"
local s_tr1 = "0ptkcmnsyrl1f2z"
local s_tr2 = "eioa"
local w = "ᐍᐏᐓᐘᐻᐽᑁᑅᑘᑚᑞᑢᑵᑷᑻᑿᒓᒕᒙᒝᒭᒯᒳᒷᓊ ᓌ ᓷᓹᓽᔁᔰᔲᔶᔺᔘᔚᔞᔢᓝᓟᓣᓧ"
local w_tr1 = "0ptkcmnsyrz"
local w_tr2 = "eioa"
local l = "ᐄᐆᐋᐲᐴᐹᑏᑑᑖᑮᑰᑳᒌᒎᒑᒦᒨᒫᓃᓅᓈᓰᓲᓵᔩᔫᔮᕇᕋᕎᔒᔔᔖᕖᕘᕚᓖᓘᓛᐐᐔᐙ"
local l_tr1 = "0ptkcmnsyr1flw23"
local l_tr2 = "īōā"
local f = "ᐤᐦᕽᑉᑦᒡᒃᒻᓐᔅᔥᔾᓪᕐ‡ᒄᔉ"
local f_tr = "wh3ptckmns1ylr45"
text = mw.ustring.gsub(text,"ê","e")
text = mw.ustring.gsub(text,"u","o")
text = mw.ustring.gsub(text,"ii","ī")
text = mw.ustring.gsub(text,"oo","ō")
text = mw.ustring.gsub(text,"aa","ā")
text = mw.ustring.gsub(text,"()(w?)","%1 0%2")
text = mw.ustring.gsub(text,"^(w?)"," 0%1")
text = mw.ustring.gsub(text," 0","0")
mw.log(text)
text = mw.ustring.gsub(
text,
"()w()",
function(a, b)
a = w_tr1:find(a)
b = w_tr2:find(b)
local i = a * 4 + b - 4
return mw.ustring.sub(w, i, i)
end
)
for i = 1, 3 do
text = mw.ustring.gsub(text, replace, tostring(i))
end
mw.log(text)
text = mw.ustring.gsub(
text,
"()()",
function(a, b)
a = s_tr1:find(a)
b = s_tr2:find(b)
local i = a * 4 + b - 4
return mw.ustring.sub(s, i, i)
end
)
text = mw.ustring.gsub(
text,
"()()",
function(a, b)
a = l_tr1:find(a)
b = l_tr2:find(b)
local i = a * 3 + b - 3
return mw.ustring.sub(l, i, i)
end
)
for i=4, 5 do
text = mw.ustring.gsub(text, replace, tostring(i))
end
mw.log(text)
text = mw.ustring.gsub(
text,
"()",
function(a)
a = f_tr:find(a)
return mw.ustring.sub(f, a, a)
end
)
return text
end
return export