Mô đun:mch-variant
Giao diện
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[1] or word:getParent().args[1]
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, "([Kk])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, "([Aa])a", "%1ː")
new = mw.ustring.gsub(new, "([Ee])e", "%1ː")
new = mw.ustring.gsub(new, "([Ii])i", "%1ː")
new = mw.ustring.gsub(new, "([Oo])o", "%1ː")
new = mw.ustring.gsub(new, "([Uu])u", "%1ː")
new = mw.ustring.gsub(new, "([Ää])ä", "%1ː")
new = mw.ustring.gsub(new, "([Öö])ö", "%1ː")
new = mw.ustring.gsub(new, "%f[%a]([aeiouäöAEIOUÄÖ])", "q%1")
new = mw.ustring.gsub(new, "([^aeiouäöAEIOUÄÖ][aeiouäöAEIOUÄÖ][mnñŋtck\'sjdywMNÑŊTCKSJDYW]h?ʷ?[aeiouäöAEIOUÄÖ])([^\'ŋŊː%s%-][^mnñŋtck\'sjdywMNÑŊTCKSJDYW])", "%1ː%2", 1)
new = mw.ustring.gsub(new, "([^aeiouäöAEIOUÄÖ][aeiouäöAEIOUÄÖ][mnñŋtck\'sjdywMNÑŊTCKSJDYW]h?ʷ?[aeiouäöAEIOUÄÖ])([aeoäöAEOÄÖ])", "%1ː%2")
new = mw.ustring.gsub(new, "([^aeiouäöAEIOUÄÖ][aeiouäöAEIOUÄÖ][mnñŋtck\'sjdywMNÑŊTCKSJDYW]h?ʷ?[aeiouäöAEIOUÄÖ])([^\'ŋŊː%s%-][^mnñŋtck\'sjdywMNÑŊTCKSJDYW])", "%1ː%2", 1)
new = mw.ustring.gsub(new, "([^aeiouäöAEIOUÄÖ][aeiouäöAEIOUÄÖ][mnñŋtck\'sjdywMNÑŊTCKSJDYW]h?ʷ?[aeiouäöAEIOUÄÖ])([^\'ŋŊː%s%-][^mnñŋtck\'sjdywMNÑŊTCKSJDYW])", "%1ː%2", 1)
new = mw.ustring.gsub(new, "([aeiouäöAEIOUÄÖ])ː", "%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, "([aeioäöAEIOÄÖ])uw", "%1ww")
new = mw.ustring.gsub(new, "([dhn])e'a%f[%A]", "%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, "([iyIY]\'?)j", "%1jh")
br = mw.ustring.gsub(br, "%f[%a%-]j", "f")
br = mw.ustring.gsub(br, "%f[%a%-]J", "F")
br = mw.ustring.gsub(br, "([\'ouwOUW])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([ie])", "qu%1")
nt = mw.ustring.gsub(nt, "K([ie])", "Qu%1")
nt = mw.ustring.gsub(nt, "k", "c")
nt = mw.ustring.gsub(nt, "K", "C")
return nt
end
return export