模組:Sat-translit

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

這個模組會將桑塔利語未確定的文字拉丁化。

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

關於測試用例,請參閱Module:Sat-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', ['ᱜ'] = 'g', ['ᱝ'] = 'ṅ', ['ᱞ'] = 'l',
	['ᱠ'] = 'k', ['ᱡ'] = 'j', ['ᱢ'] = 'm', ['ᱣ'] = 'w',
	['ᱥ'] = 's', ['ᱦ'] = 'h', ['ᱧ'] = 'ñ', ['ᱨ'] = 'r',
	['ᱪ'] = 'c', ['ᱫ'] = 'd', ['ᱬ'] = 'ṇ', ['ᱭ'] = 'y',
	['ᱯ'] = 'p', ['ᱰ'] = 'ḍ', ['ᱱ'] = 'n', ['ᱲ'] = 'ṛ',
	['ᱴ'] = 'ṭ', ['ᱵ'] = 'b', ['ᱶ'] = 'v', ['ᱷ'] = 'ʰ',

	-- vowels
	['ᱚ'] = 'ô', ['ᱟ'] = 'a', ['ᱤ'] = 'i', ['ᱩ'] = 'u', ['ᱮ'] = 'e', ['ᱳ'] = 'o',
	['ᱚᱹ'] = 'ô', ['ᱟᱹ'] = 'ə', ['ᱮᱹ'] = 'ɛ',
	['ᱚᱺ'] = 'ỗ', ['ᱟᱺ'] = 'ə̃', ['ᱮᱺ'] = 'ɛ̃',

	-- special stuff   
	['ᱸ']='̃',

	--numerals
	['᱐']='0', ['᱑']='1', ['᱒']='2', ['᱓']='3', ['᱔']='4', ['᱕']='5', ['᱖']='6', ['᱗']='7', ['᱘']='8', ['᱙']='9',

	--punctuation
	['᱾'] = '.', ['᱿'] = '.',
}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(text, '([᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙ᱚᱛᱜᱝᱞᱟᱠᱡᱢᱣᱤᱥᱦᱧᱨᱩᱪᱫᱬᱭᱮᱯᱰᱱᱲᱳᱴᱵᱶᱷᱸᱻᱼᱽ᱾᱿]ᱹ?ᱺ?)', tt)
	text = mw.ustring.gsub(text, '.', tt)
	
	return text
end
 
return export