模組:Narb-translit

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

這個模組會將古北阿拉伯字母文字轉寫為拉丁字母。

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

關於測試用例,請參閱Module:Narb-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 chars = {
	["𐪏"] = "s³", ["𐪙"] = "ḏ", ["𐪍"] = "ẖ", ["𐪊"] = "s¹", ["𐪆"] = "s²", 
	["𐪛"] = "ṯ", ["𐪑"] = "ʾ", ["𐪒"] = "ʿ", ["𐪈"] = "b", ["𐪕"] = "d", 
	["𐪓"] = "ḍ", ["𐪐"] = "f", ["𐪔"] = "g", ["𐪖"] = "ġ", ["𐪀"] = "h",
	["𐪂"] = "ḥ", ["𐪋"] = "k", ["𐪁"] = "l", ["𐪃"] = "m", ["𐪌"] = "n",
	["𐪄"] = "q", ["𐪇"] = "r", ["𐪎"] = "ṣ", ["𐪉"] = "t", ["𐪗"] = "ṭ",
	["𐪅"] = "w", ["𐪚"] = "y", ["𐪘"] = "z", ["𐪜"] = "ẓ",
}

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

return export