模組:Mani-translit
這個模組會將摩尼字母文字轉寫為拉丁字母。
最好不要直接從模板或其他模組調用此模組。要從模板中使用它,請以{{xlit}}
做為替代;若要在模組中使用,則以Module:languages#Language:transliterate替代。
關於測試用例,請參閱Module:Mani-translit/testcases。
函數
[编辑]tr(text, lang, sc)
- Transliterates a given piece of
text
written in the script specified by the codesc
, and language specified by the codelang
. When the transliteration fails, returnsnil
.
local export = {}
local tt = {
["𐫀"] = "ʾ", -- aleph
["𐫁"] = "b", -- beth
["𐫂"] = "β", -- bheth
["𐫃"] = "g", -- gimel
["𐫄"] = "ǧ", -- ghimel
["𐫅"] = "d", -- daleth
["𐫆"] = "ẖ", -- he
["𐫇"] = "w", -- waw
["𐫈"] = "ẉ̇", -- ud (conjunction)
["𐫉"] = "z", -- zayin
["𐫊"] = "ž", -- zhayin
["𐫋"] = "j", -- jayin
["𐫌"] = "ǰ", -- jhayin
["𐫍"] = "h", -- heth
["𐫎"] = "ṯ", -- teth
["𐫏"] = "y", -- yodh
["𐫐"] = "k", -- kaph
["𐫑"] = "k̇", -- xaph
["𐫒"] = "k̈", -- khaph
["𐫓"] = "l", -- lamedh
["𐫔"] = "δ", -- dhamedh
["𐫕"] = "θ", -- thamedh
["𐫖"] = "m", -- mem
["𐫗"] = "n", -- nun
["𐫘"] = "s", -- samekh
["𐫙"] = "ʿ", -- ayin
["𐫚"] = "ʿ̈ ", -- aayin
["𐫛"] = "p", -- pe
["𐫜"] = "f", -- fe
["𐫝"] = "c", -- sadhe
["𐫞"] = "q", -- qoph
["𐫟"] = "x", -- xoph
["𐫠"] = "q̈", -- qhoph
["𐫡"] = "r", -- resh
["𐫢"] = "š", -- shin
["𐫣"] = "ś", -- sshin
["𐫤"] = "t", -- taw
["◌𐫥"] = "̃", -- abbreviation mark above
["◌𐫦"] = "̃", -- abbreviation mark below
["𐫫"] = "1", -- one
["𐫬"] = "5", -- five
["𐫭"] = "10", -- ten
["𐫮"] = "20", -- twenty
["𐫯"] = "100", -- one hundred
}
function export.tr(text, lang, sc)
-- If the script is not Mani, do not transliterate
if sc ~= "Mani" then
return
end
-- Transliterate characters
text = mw.ustring.gsub(text, '.', tt)
return text
end
return export