มอดูล:Mlym-translit
หน้าตา
- The following documentation is located at มอดูล:Mlym-translit/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate text in the อักษรมลยาฬัม. It is used to transliterate พทคะ, Bellari, Kodava, Kurichiya, กงกัณ, Malavedan, Mannan, มลยาฬัม, สันสกฤต, ตูลู, Muduga, และRavula.
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:Mlym-translit/testcases.
Functions
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, returns
nil
.
local export = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local letter_with_mark = "(.["..u(0x0300).."-"..u(0x036F).."]?)"
local tt = {
-- consonants
["ക"] = "ก", ["ഖ"] = "ข", ["ഗ"] = "ค", ["ഘ"] = "ฆ", ["ങ"] = "ง",
["ച"] = "จ", ["ഛ"] = "ฉ", ["ജ"] = "ช", ["ഝ"] = "ฌ", ["ഞ"] = "ญ",
["ട"] = "ฏ", ["ഠ"] = "ฐ", ["ഡ"] = "ฑ", ["ഢ"] = "ฒ", ["ണ"] = "ณ",
["ത"] = "ต", ["ഥ"] = "ถ", ["ദ"] = "ท", ["ധ"] = "ธ", ["ന"] = "น", ["ഩ"] = "น̱",
["പ"] = "ป", ["ഫ"] = "ผ", ["ബ"] = "พ", ["ഭ"] = "ภ", ["മ"] = "ม",
["യ"] = "ย", ["ര"] = "ร", ["റ"] = "ร̱", ["ല"] = "ล", ["ള"] = "ฬ", ["ഴ"] = "ฬ̱", ["വ"] = "ว",
["ശ"] = "ศ", ["ഷ"] = "ษ", ["സ"] = "ส", ["ഹ"] = "ห", ["ഺ"] = "ต̱",
["ൺ"] = "ณฺ", ["ൻ"] = "นฺ", ["ർ"] = "รฺ", ["ൽ"] = "ลฺ", ["ൾ"] = "ฬฺ", ["ൿ"] = "กฺ",
-- independent vowels
["അ"] = "อ", ["ആ"] = "อา", ["ഇ"] = "อิ", ["ഈ"] = "อี", ["ഉ"] = "อุ", ["ഊ"] = "อู",
["ഋ"] = "ฤ", ["ൠ"] = "ฤๅ", ["ഌ"] = "ฦ", ["ൡ"] = "ฦๅ",
["എ"] = "เอะ", ["ഏ"] = "เอ", ["ഐ"] = "ไอ", ["ഒ"] = "โอะ", ["ഓ"] = "โอ", ["ഔ"] = "เอา",
["ൟ"] = "อี",
-- dependent vowels and diacritics (excluding front type)
["ാ"] = "า", ["ി"] = "ิ", ["ീ"] = "ี", ["ു"] = "ุ", ["ൂ"] = "ู",
["ൃ"] = "ฺฤ", ["ൄ"] = "ฺฤๅ", ["ൢ"] = "ฺฦ", ["ൣ"] = "ฺฦๅ",
["ൗ"] = "~", ["ൎ"] = "รฺ", ["ം"] = "ํ", ["ഃ"] = "ห์", ["്"] = "ฺ",
["ഁ"] = "ม̐", -- candrabindu
-- marks
["ഽ"] = "-",
-- numerals
["൦"] = "0", ["൧"] = "1", ["൨"] = "2", ["൩"] = "3", ["൪"] = "4",
["൫"] = "5", ["൬"] = "6", ["൭"] = "7", ["൮"] = "8", ["൯"] = "9",
["൰"] = "[10]", ["൱"] = "[100]", ["൲"] = "[1000]", ["൳"] = "¼", ["൴"] = "½", ["൵"] = "¾",
-- zero-width space (display it if it hides in a word)
[u(0x200B)] = "‼",
}
local adjust0 = {
-- for convenience
["ഇ".."ൗ"] = "ഈ", ["ഉ".."ൗ"] = "ഊ", ["എ".."െ"] = "ഐ", ["ഒ".."ാ"] = "ഓ", ["ഒ".."ൗ"] = "ഔ",
["െ".."െ"] = "ൈ", ["െ".."ാ"] = "ൊ", ["േ".."ാ"] = "ോ", ["െ".."ൗ"] = "ൌ",
}
local adjust1 = {
-- dependent vowels (front type)
["െ"] = "เ%1ะ", ["േ"] = "เ%1", ["ൈ"] = "ไ%1", ["ൊ"] = "โ%1ะ", ["ോ"] = "โ%1", ["ൌ"] = "เ%1า",
}
function export.tr(text, lang, sc, debug_mode)
if type(text) == "table" then -- called directly from a template
text = text.args[1]
end
for k, v in pairs(adjust0) do
text = gsub(text, k, v)
end
text = gsub(text, ".", tt)
for k, v in pairs(adjust1) do
text = gsub(text, letter_with_mark..k, v)
end
text = gsub(text, "([เแไโ])อฺ", "อฺ%1")
text = gsub(text, "ะ"..letter_with_mark.."ฺ", "็%1ฺ") -- เปลี่ยน ะ ที่มีตัวสะกดตามเป็นไม้ไต่คู้
-- ย้ายสัญลักษณ์ขึ้นบน เมื่อมีสระล่าง (ยกเว้นตัวที่ไม่มี)
text = gsub(text, u(0x0331).."([ุ-ฺ])", u(0x0304).."%1") -- macron below > macron above
return text
end
return export
หมวดหมู่:
- อักษรมลยาฬัม
- Transliteration modules without a testcases subpage
- มอดูลการถอดอักษรแบ่งตามอักษร
- มอดูลอักษรมลยาฬัม
- มอดูลการถอดอักษร
- มอดูลภาษาKodava
- มอดูลภาษาMannan
- มอดูลภาษามลยาฬัม
- มอดูลภาษาMalavedan
- มอดูลภาษาMuduga
- มอดูลภาษาRavula
- มอดูลภาษาตูลู
- มอดูลภาษาKurichiya
- มอดูลภาษาพทคะ
- มอดูลภาษาBellari
- มอดูลภาษากงกัณ
- มอดูลภาษาสันสกฤต