Module:User:Sameerhameedy/kk-convert


Example

edit
  •  Arabic : بارلىق ادامدار تۋمىسىنان ازات جانە ٴقادىر-قاسيەتى مەن كۇقىقتارى تەڭ بولىپ دۇنيەگە كەلەدى. ادامدارعا اقىل-پاراسات، ار-وجدان بەرىلگەن، سوندىقتان ولار ٴبىر-بىرىمەن تۋىستىق، باۋىرمالدىق قارىم-قاتىناس جاساۋلارى ٴتيىس.
  •  Cyrillic : Барлық адамдар тумысынан азат және қадір-қасиеті мен кұқықтары тең болып дүниеге келеді. Адамдарға ақыл-парасат, ар-ождан берілген, сондықтан олар бір-бірімен туыстық, бауырмалдық қарым-қатынас жасаулары тиіс.
  •  Latin : Barlyq adamdar tumysynan azat jäne qadır-qasietı men kūqyqtary teñ bolyp düniege keledı. Adamdarğa aqyl-parasat, ar-ojdan berılgen, sondyqtan olar bır-bırımen tuystyq, bauyrmaldyq qarym-qatynas jasaulary tiıs.
    •  Pinyin : Barleq adamdar twmesenan azat jənê qadir-qasyêti mên ⱪuqeqtare têng bolep dünyêgê ⱪêlêdi. Adamdarƣa aqel-parasat, ar-ojdan bêrilgên, sondeqtan olar bir-birimên twesteq, bawermaldeq qarem-qatenas jasawlare tyis.
    •  Yañalif 1927 : Lua error: bad argument #2 to 'gsub' (string expected, got nil)
    •  Yañalif 1938 : Barlьq adamdar tumьsьnan azat çəne qadjr-qasjetj men kūqьqtarь teꞑ ʙolьp dynjege keledj. Adamdarƣa aqьl-parasat, ar-oçdan ʙerjlgen, sondьqtan olar ʙjr-ʙjrjmen tuьstьq, ʙauьrmaldьq qarьm-qatьnas çasaularь tjjs.

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