模組:Rohg-translit

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

這個模組會將哈乃斐羅興亞文字文字轉寫為拉丁字母。

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

關於測試用例,請參閱Module:Rohg-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 = {
	-- consonants
	["𐴀"]='', ["𐴁"]='b', ["𐴃"]='t', ["𐴄"]='th',
	["𐴅"]='j', ["𐴆"]='ch', ["𐴇"]='h', ["𐴈"]='kh',
	["𐴉"]='f', ["𐴂"]='p', ["𐴊"]='d', ["𐴋"]='dh',
	["𐴌"]='r', ["𐴍"]='ç', ["𐴎"]='z', ["𐴏"]='s',
	["𐴐"]='c', ["𐴑"]='k', ["𐴒"]='g', ["𐴓"]='l',
	["𐴔"]='m', ["𐴕"]='n', ["𐴖"]='w', ["𐴗"]='u̯',
	["𐴘"]='y', ["𐴙"]='i̯', ["𐴚"]='ng', ["𐴛"]='ny', ["𐴜"]='v',
	
	-- vowels
	["𐴝"]='a', ["𐴞"]='i', ["𐴟"]='u', ["𐴠"]='e', ["𐴡"]='o',
	["𐴢"]='',
	
	-- numerals
	["𐴰"]='0', ["𐴱"]='1', ["𐴲"]='2', ["𐴳"]='3', ["𐴴"]='4',
	["𐴵"]='5', ["𐴶"]='6', ["𐴷"]='7', ["𐴸"]='8', ["𐴹"]='9'
};

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(text, '.', tt)
	text = mw.ustring.gsub(text, '(.)𐴤', '%1́')
	text = mw.ustring.gsub(text, '(.)𐴥', '%1́%1')
	text = mw.ustring.gsub(text, '(.)𐴦', '%1%1́')
	text = mw.ustring.gsub(text, '(.)𐴧', '%1%1')
	return text
end

return export