local export = {}
local rsubn = mw.ustring.gsub
local match = mw.ustring.match
local sub = mw.ustring.sub
local u = mw.ustring.char
local vowels = "үҮиИеЕәӘөӨӯӮАаоОЫыІіЯяЮюЁё"
--this is for yanalif spellings in kk-alt, not the ordinary romanization
local pinyin = {
["ү"]="ü",["Ү"]="Ü",["ш"]="x",["Ш"]="X",["й"]="y",["Й"]="Y"
,["ы"]="e",["Ы"]="E",["и"]="y",["И"]="Y",["у"]="w",["У"]="W"
,["ң"]="ng",["Ң"]="ng",["ә"]="ə",["Ә"]="Ə",["ғ"]="ƣ",["Ғ"]="Ƣ"
,["і"]="i",["І"]="I",["ө"]="ɵ",["Ө"]="Ɵ",["һ"]="ⱨ",["Һ"]="Ⱨ"
,["х"]="h",["Х"]="H",["к"]="ⱪ",["К"]="Ⱪ",["е"]="ê",["Е"]="ê"
,["ұ"]="u",["Ұ"]="U"
--mostly in loanwords from Russian
,["ё"]="io",["Ё"]="Io",["ч"]="q",["Ч"]="Q",["щ"]="x",["Щ"]="X"
,["ъ"]="ʼ",["Ъ"]="ʼ",["ю"]="iu",["Ю"]="Iu"
,["я"]="ia",["Я"]="Ia"}
local newyan = {
["ү"]="y",["Ү"]="Y",["ш"]="c",["Ш"]="C",["й"]="i",["Й"]="I",["б"]="ʙ"
,["и"]="j",["И"]="J",["ж"]="ç",["Ж"]="Ç"
,["ң"]="ꞑ",["Ң"]="Ꞑ",["ә"]="ə",["Ә"]="Ə",["ғ"]="ƣ",["Ғ"]="Ƣ"
,["і"]="j",["І"]="J",["ө"]="ɵ",["Ө"]="Ɵ"
--mostly in loanwords from Russian
,["ё"]="io",["Ё"]="Io",["ч"]="c",["Ч"]="Tc",["щ"]="cc",["Щ"]="Cc"
,["ъ"]="ʼ",["Ъ"]="ʼ",["ю"]="iu",["Ю"]="Iu"
,["я"]="ia",["Я"]="Ia"}
local oldyan = {
["ү"]="y",["Ү"]="Y",["ш"]="c",["Ш"]="C",["й"]="i",["Й"]="I",["б"]="ʙ"
,["ы"]="ь",["Ы"]="Ь",["и"]="j",["И"]="J",["ж"]="ç",["Ж"]="Ç"
,["ң"]="ꞑ",["Ң"]="Ꞑ",["ә"]="ə",["Ә"]="Ə",["ғ"]="ƣ",["Ғ"]="Ƣ"
,["і"]="j",["І"]="J",["ө"]="ɵ",["Ө"]="Ɵ"
--mostly in loanwords from Russian
,["ё"]="io",["Ё"]="Io",["ч"]="c",["Ч"]="Tc",["щ"]="cc",["Щ"]="Cc"
,["ъ"]="ʼ",["Ъ"]="ʼ",["ю"]="iu",["Ю"]="Iu"
,["я"]="ia",["Я"]="Ia"}
function export.tr(text, script, options)
if type(text) == "table" then
options = {}
options.impl = text.args["impl"]
options.variation = text.args["variation"] --ID of variation: [Mymr: 1=Mon, 2=Old Shan, 3=New Shan]
text, script = text.args[1], text.args[2]
end
if script == "Cyrl" then
return text
end
if script ~= "Latn" then
return require("Module:kk-Cyrl-Arab-translit").tr(text, "kk", sc)
elseif script == "Latn" then
if not (options and options.variation) then
return require("Module:kk-translit").tr(text, "kk", sc)
elseif options.variation == "1" then
text = rsubn(text, ".", pinyin)
return require("Module:kk-translit").tr(text, "kk", sc)
elseif options.variation == "2" then
text = rsubn(text, ".", newyan)
return require("Module:kk-translit").yanalif(text, "kk", sc)
end
elseif options.variation == "3" then
-- need to change the character mappings but its not even working so
--w/e
return require("Module:kk-translit").yanalif(text, "kk", sc)
end
text = rsubn(text, orig_word, word, 1)
local impl = options and options.impl or 'yes'
if impl == 'no' then text = export.mono_form(text, script) end
return text
end
return export