Modul:mnc-translit
- Berikut merupakan pendokumenan yang dijana oleh Modul:pendokumenan/functions/translit. [sunting]
- Pautan berguna: senarai sublaman • pautan • transklusi • kes ujian • kotak pasir
Modul ini akan mentransliterasi Bahasa Manchu teks. Ia juga digunakan untuk mentransliterasi Sanskrit and Tibet Klasik.
The module should preferably not be called directly from templates or other modules.
To use it from a template, use {{xlit}}
.
Within a module, use Module:languages#Language:transliterate.
For testcases, see Module:mnc-translit/testcases.
Functions
suntingtr(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, returns
nil
.
local export = {}
local conv = {
["ᠠ"] = "a",
["ᡝ"] = "e",
["ᡳ"] = "i",
["ᡟ"] = "y",
["ᠣ"] = "o",
["ᡠ"] = "u",
["ᡡ"] = "ū",
["ᠨ"] = "n",
["ᠩ"] = "ng",
["ᡴ"] = "k",
["ᡤ"] = "g",
["ᡥ"] = "h",
["ᠪ"] = "b",
["ᡦ"] = "p",
["ᠰ"] = "s",
["ᡧ"] = "š",
["ᡨ"] = "t",
["ᡩ"] = "d",
["ᠯ"] = "l",
["ᠮ"] = "m",
["ᠴ"] = "c",
["ᠵ"] = "j",
["ᠶ"] = "y",
["ᡵ"] = "r",
["ᡶ"] = "f",
["ᠸ"] = "w",
["ᠺ"] = "k'",
["ᡬ"] = "g'",
["ᡭ"] = "h'",
["ᡮ"] = "ts'",
["ᡮᡟ"] = "ts",
["ᡯ"] = "dz",
["ᡰ"] = "ž",
["ᠰᡟ"] = "sy",
["ᡱ"] = "c'",
["ᡱᡳ"] = "c'y",
["ᡷ"] = "j",
["ᡷᡳ"] = "jy",
[""] = "-",
["᠈"] = ",",
["᠉"] = ".",
[" "] = "-",
["᠊"] = "-"
}
function export.tr(text, lang, sc)
if sc ~= "Mong" then
return nil
end
text = mw.ustring.gsub(text, "([ᠠᡝᡳᡟᠣᡠᡡᠨᠩᡴᡤᡥᠪᡦᠰᡧᡨᡩᠯᠮᠴᠵᠶᡵᡶᠸᠺᡬᡭᡮᡯᡰᡱᡷ᠈᠉])([ᡟᡳ]?)", function(a, b)
return conv[a..b] or conv[a] .. conv[b] end)
return text
end
return export