มอดูล:Rohg-translit
หน้าตา
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate text in the อักษรฮานิฟ. It is used to transliterate โรฮีนจา.
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:Rohg-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 u = mw.ustring.char
local tt = {
-- consonants
["𐴀"]="อ", ["𐴁"]="บ", ["𐴃"]="ต", ["𐴄"]="ฏ",
["𐴅"]="จฺ", ["𐴆"]="จ", ["𐴇"]="ฮ", ["𐴈"]="ฅ",
["𐴉"]="ฟ", ["𐴂"]="ป", ["𐴊"]="ด", ["𐴋"]="ฎ",
["𐴌"]="ร", ["𐴍"]="รฺ", ["𐴎"]="ซฺ", ["𐴏"]="ซ",
["𐴐"]="ศ", ["𐴑"]="ก", ["𐴒"]="กฺ", ["𐴓"]="ล",
["𐴔"]="ม", ["𐴕"]="น", ["𐴖"]="ว", ["𐴗"]="ว์",
["𐴘"]="ย", ["𐴙"]="ย์", ["𐴚"]="ง", ["𐴛"]="ญ", ["𐴜"]="วฺ",
-- vowels
["𐴝"]="า", ["𐴞"]="ี", ["𐴟"]="ู", ["𐴠"]="↶เ", ["𐴡"]="↶โ",
-- others
["𐴢"]="", --only used after some ending consonants
["𐴣"]="ํ", --nasalization
[u(0x200D)]="", --ZWJ, might appear to adjust consonants
-- numerals
["𐴰"]="0", ["𐴱"]="1", ["𐴲"]="2", ["𐴳"]="3", ["𐴴"]="4",
["𐴵"]="5", ["𐴶"]="6", ["𐴷"]="7", ["𐴸"]="8", ["𐴹"]="9",
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, ".", tt)
text = mw.ustring.gsub(text, "(.ฺ?)↶([เโ])", "%2%1")
-- tones and special mark
text = mw.ustring.gsub(text, "(.)𐴤", "%1́")
text = mw.ustring.gsub(text, "(.)𐴥", "%1́%1")
text = mw.ustring.gsub(text, "(.)𐴦", "%1%1́")
text = mw.ustring.gsub(text, "(.)𐴧", "%1%1")
return text
end
return export