跳转到内容

模組:Kim-translit

維基詞典,自由的多語言詞典

這個模組會將圖法語未確定的文字拉丁化。

最好不要直接從模板或其他模組調用此模組。要從模板中使用它,請以{{xlit}}做為替代;若要在模組中使用,則以Module:languages#Language:transliterate替代。

關於測試用例,請參閱Module:Kim-translit/testcases

函數

[编辑]
tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang. When the transliteration fails, returns nil.

local export = {}

local tt = {
	["ү"]="ü",['Ү']='Ü',   ["т"]="t",['Т']='T', ["һ"]="h",['Һ']='H', ["р"]="r",['Р']='R',   ["ф"]="f",['Ф']='F',
	["ю"]="yu",['Ю']='Yu', ["ш"]="ş",['Ш']='Ş', ["ь"]="ʹ",['Ь']='ʹ',   ["ъ"]="ʺ",['Ъ']='ʺ', ["н"]="n",['Н']='N', 
	["п"]="p",['П']='P',   ["й"]="y",['Й']='Y', ["л"]="l",['Л']='L',   ["з"]="z",['З']='Z', ["е"]="e",['Е']='E', 
	["г"]="g",['Г']='G',   ["б"]="b",['Б']='B', ["у"]="u",['У']='U',   ["с"]="s",['С']='S', ["х"]="x",['Х']='X',
	["ч"]="ç",['Ч']='Ç', ["щ"]="şç",['Щ']='Şç', ["я"]="ya",['Я']='Ya', ["ы"]="ı",['Ы']='I', ["э"]="e",['Э']='E', 
	["м"]="m",['М']='M',   ["о"]="o",['О']='O', ["и"]="i",['И']='I', ["ё"]="yo",['Ё']='Yo', ["ж"]="c",['Ж']='C',
	["к"]="k",['К']='K',   ["д"]="d",['Д']='D', ["в"]="v",['В']='V', ["ц"]="Ts",['Ц']='ts', ["а"]="a",['А']='A',
	["ң"]="ñ",['Ң']='Ñ',   ["ә"]="ä",['Ә']='Ä', ["э"]="e",['Э']='E', ["Ҷ"]="J",['ҷ']='j', ["қ"]="q",['Қ']="Q",
	["ғ"]="ğ",['Ғ']='Ğ',   ["һ"]="h",['Һ']='H', ["ө"]="ö",['Ө']='Ö'
};

function export.tr(text)
	return (mw.ustring.gsub(text, '.', tt))
end

return export