local export = {}
local PAGENAME = mw.title.getCurrentTitle().text
local lang = require("Module:languages").getByCode("mch")
function export.common(word)
if type(word) == "table" then
word = word.args or word:getParent().args
end
if not word or (word == "") then
word = PAGENAME
end
local new = word
-- unconditional changes
new = mw.ustring.gsub(new, "n'", "ŋ")
new = mw.ustring.gsub(new, "N'", "Ŋ")
new = mw.ustring.gsub(new, "()w", "%1ʷ")
new = mw.ustring.gsub(new, "ö", "ä")
new = mw.ustring.gsub(new, "Ö", "Ä")
new = mw.ustring.gsub(new, "ü", "ö")
new = mw.ustring.gsub(new, "Ü", "Ö")
-- long vowels and ng
new = mw.ustring.gsub(new, "()a", "%1ː")
new = mw.ustring.gsub(new, "()e", "%1ː")
new = mw.ustring.gsub(new, "()i", "%1ː")
new = mw.ustring.gsub(new, "()o", "%1ː")
new = mw.ustring.gsub(new, "()u", "%1ː")
new = mw.ustring.gsub(new, "()ä", "%1ː")
new = mw.ustring.gsub(new, "()ö", "%1ː")
new = mw.ustring.gsub(new, "%f()", "q%1")
new = mw.ustring.gsub(new, "(h?ʷ?)()", "%1ː%2", 1)
new = mw.ustring.gsub(new, "(h?ʷ?)()", "%1ː%2")
new = mw.ustring.gsub(new, "(h?ʷ?)()", "%1ː%2", 1)
new = mw.ustring.gsub(new, "(h?ʷ?)()", "%1ː%2", 1)
new = mw.ustring.gsub(new, "()ː", "%1%1")
new = mw.ustring.gsub(new, "ŋ", "ng")
new = mw.ustring.gsub(new, "Ŋ", "Ng")
new = mw.ustring.gsub(new, "ʷ", "w")
new = mw.ustring.gsub(new, "q", "")
-- other
new = mw.ustring.gsub(new, "()uw", "%1ww")
new = mw.ustring.gsub(new, "()e'a%f", "%1ea")
return new
end
function export.to_Brazilian(word)
br = export.common(word)
br = mw.ustring.gsub(br, "ñ", "nh")
br = mw.ustring.gsub(br, "Ñ", "Nh")
br = mw.ustring.gsub(br, "(\'?)j", "%1jh")
br = mw.ustring.gsub(br, "%fj", "f")
br = mw.ustring.gsub(br, "%fJ", "F")
br = mw.ustring.gsub(br, "()j", "%1f")
br = mw.ustring.gsub(br, "fh", "jh")
br = mw.ustring.gsub(br, "jhj", "jjh")
return br
end
function export.to_New_Tribes(word)
nt = export.common(word)
nt = mw.ustring.gsub(nt, "jh", "ij")
nt = mw.ustring.gsub(nt, "Jh", "Ij")
nt = mw.ustring.gsub(nt, "k()", "qu%1")
nt = mw.ustring.gsub(nt, "K()", "Qu%1")
nt = mw.ustring.gsub(nt, "k", "c")
nt = mw.ustring.gsub(nt, "K", "C")
return nt
end
return export