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
options.variation = text.args --ID of variation:
text, script = text.args, text.args
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