跳转到内容

模組:Mk-translit

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

這個模組會將馬其頓語未確定的文字拉丁化。

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

關於測試用例,請參閱Module:Mk-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.

-- Transliteration for Macedonian 馬其頓語轉譯

local export = {}
 
local tt = {
	["А"]='A', ["а"]='a',
	["Б"]='B', ["б"]='b',
	["В"]='V', ["в"]='v',
	["Г"]='G', ["г"]='g',
	["Ѓ"]='Ǵ', ["ѓ"]='ǵ', 
	["Д"]='D', ["д"]='d',
	["Е"]='E', ["е"]='e', ["Ѐ"]='È', ["ѐ"]='è',
	["Ж"]='Ž', ["ж"]='ž',
	["З"]='Z', ["з"]='z',
	["Ѕ"]='Dz', ["ѕ"]='dz', 
	["И"]='I', ["и"]='i', ["Ѝ"]='Ì', ["ѝ"]='ì',
	["Ј"]='J', ["ј"]='j',
	["К"]='K', ["к"]='k',
	["Л"]='L', ["л"]='l',
	["Љ"]='Lj', ["љ"]='lj', 
	["М"]='M', ["м"]='m',
	["Н"]='N', ["н"]='n',
	["Њ"]='Nj', ["њ"]='nj',
	["О"]='O', ["о"]='o',
	["П"]='P', ["п"]='p', 
	["Р"]='R', ["р"]='r',
	["С"]='S', ["с"]='s',
	["Т"]='T', ["т"]='t',
	["Ќ"]='Ḱ', ["ќ"]='ḱ',
	["У"]='U', ["у"]='u', 
	["Ф"]='F', ["ф"]='f',
	["Х"]='H', ["х"]='h',
	["Ц"]='C', ["ц"]='c',
	["Ч"]='Č', ["ч"]='č',
	["Џ"]='Dž', ["џ"]='dž', 
	["Ш"]='Š', ["ш"]='š',
};

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

return export