ผลต่างระหว่างรุ่นของ "มอดูล:blk-translit"
หน้าตา
เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
Octahedron80 (คุย | ส่วนร่วม) ไม่มีความย่อการแก้ไข |
ไม่มีความย่อการแก้ไข ป้ายระบุ: ถูกย้อนกลับแล้ว |
||
บรรทัดที่ 10: | บรรทัดที่ 10: | ||
local tt1 = { |
local tt1 = { |
||
-- consonants |
-- consonants |
||
['က'] = ' |
['က'] = 'k', ['ခ'] = 'kh', ['ဂ'] = 'g', ['ဃ'] = 'gh', ['င'] = 'ṅ', |
||
['စ'] = ' |
['စ'] = 'k', ['ဆ'] = 'ch', ['ဇ'] = 'j', ['ဈ'] = 'jh', ['ည'] = 'ñ', |
||
['ဋ'] = ' |
['ဋ'] = 'ṭ', ['ဌ'] = 'ṭh', ['ဍ'] = 'ḍ', ['ဎ'] = 'ḍh', ['ၮ'] = 'ṇ', ["ဏ"] = 'ṇ', |
||
['တ'] = ' |
['တ'] = 't', ['ထ'] = 'th', ['ဒ'] = 'd', ['ဓ'] = 'dh', ['န'] = 'n', |
||
['ပ'] = ' |
['ပ'] = 'p', ['င'] = 'ph', ['ဗ'] = 'b', ['ဘ'] = 'bh', ['မ'] = 'm', |
||
['ယ'] = ' |
['ယ'] = 'y', ['ရ'] = 'r', ['လ'] = 'l', ['ဝ'] = 'w', ['သ'] = 's', |
||
['ဟ'] = ' |
['ဟ'] = 'h', ['ဠ'] = 'ḷ', ['အ'] = 'ʼ', |
||
-- independent vowels (1) |
-- independent vowels (1) |
||
['ဣ'] = ' |
['ဣ'] = 'i', ['ဤ'] = 'ī', ['ဥ'] = 'u', ['ဉ'] = 'u', ['ဦ'] = 'ū', ['ဩ'] = 'āo', |
||
-- dependent vowels and diacritics (excluding front type) |
-- dependent vowels and diacritics (excluding front type) |
||
['ါ'] = ' |
['ါ'] = 'ā', ['ာ'] = 'ā', ['ိ'] = 'i', ['ီ'] = 'ī', ['ု'] = 'u', ['ူ'] = 'ū', ['ွ'] = 'w', ['ျ'] = 'y', |
||
['ံ'] = ' |
['ံ'] = 'ṁ', ['့'] = '.', ['း'] = 'ḥ', [''] = '́', ['ႏ'] = '́', ['ꩻ'] = '̀', [''] = '̀', ['္'] = '¡', ['်'] = 'o', |
||
-- numerals |
-- numerals |
||
['၀'] = ' |
['၀'] = '0', ['၁'] = '1', ['၂'] = '2', ['၃'] = '3', ['၄'] = '4', |
||
[' |
[''] = '0', [''] = '1', [''] = '2', [''] = '3', [''] = '4', |
||
['၅'] = '5', ['၆'] = '6', ['၇'] = '7', ['၈'] = '8', ['၉'] = '9', |
|||
-- zero-width space (display it if it hides in a word) |
|||
[''] = '5', [''] = '6', [''] = '7', [''] = '8', [''] = '9', |
|||
[u(0x200B)] = '‼', |
|||
} |
} |
||
local adjust1 = { |
local adjust1 = { |
||
-- dependent vowels (front type) |
-- dependent vowels (front type) |
||
['ေ'] = 'ē', ['ဲ'] = 'ae', ['ော်'] = 'āo', ['ေ့'] = 'e', ['ဲ့'] = 'ea', ['ုဲင့်'] = 'ai', ['ဲုင်'] = 'āi', ['ော့'] = 'ao', ['ို့'] = 'o', ['ို'] = 'ō', |
|||
['ေ'] = 'เ%1', ['ဲ'] = 'แ%1', |
|||
} |
} |
||
รุ่นแก้ไขเมื่อ 18:21, 28 กันยายน 2567
- The following documentation is generated by Module:documentation/functions/translit. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will transliterate ภาษากะเหรี่ยงปะโอ text.
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:blk-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 pre = {
['ျ'] = '္ယ', ['ြ'] = '္ရ', ['ွ'] = '္ဝ', ['ှ'] = '္ဟ',
}
local tt1 = {
-- consonants
['က'] = 'k', ['ခ'] = 'kh', ['ဂ'] = 'g', ['ဃ'] = 'gh', ['င'] = 'ṅ',
['စ'] = 'k', ['ဆ'] = 'ch', ['ဇ'] = 'j', ['ဈ'] = 'jh', ['ည'] = 'ñ',
['ဋ'] = 'ṭ', ['ဌ'] = 'ṭh', ['ဍ'] = 'ḍ', ['ဎ'] = 'ḍh', ['ၮ'] = 'ṇ', ["ဏ"] = 'ṇ',
['တ'] = 't', ['ထ'] = 'th', ['ဒ'] = 'd', ['ဓ'] = 'dh', ['န'] = 'n',
['ပ'] = 'p', ['င'] = 'ph', ['ဗ'] = 'b', ['ဘ'] = 'bh', ['မ'] = 'm',
['ယ'] = 'y', ['ရ'] = 'r', ['လ'] = 'l', ['ဝ'] = 'w', ['သ'] = 's',
['ဟ'] = 'h', ['ဠ'] = 'ḷ', ['အ'] = 'ʼ',
-- independent vowels (1)
['ဣ'] = 'i', ['ဤ'] = 'ī', ['ဥ'] = 'u', ['ဉ'] = 'u', ['ဦ'] = 'ū', ['ဩ'] = 'āo',
-- dependent vowels and diacritics (excluding front type)
['ါ'] = 'ā', ['ာ'] = 'ā', ['ိ'] = 'i', ['ီ'] = 'ī', ['ု'] = 'u', ['ူ'] = 'ū', ['ွ'] = 'w', ['ျ'] = 'y',
['ံ'] = 'ṁ', ['့'] = '.', ['း'] = 'ḥ', [''] = '́', ['ႏ'] = '́', ['ꩻ'] = '̀', [''] = '̀', ['္'] = '¡', ['်'] = 'o',
-- numerals
['၀'] = '0', ['၁'] = '1', ['၂'] = '2', ['၃'] = '3', ['၄'] = '4',
[''] = '0', [''] = '1', [''] = '2', [''] = '3', [''] = '4',
['၅'] = '5', ['၆'] = '6', ['၇'] = '7', ['၈'] = '8', ['၉'] = '9',
[''] = '5', [''] = '6', [''] = '7', [''] = '8', [''] = '9',
}
local adjust1 = {
-- dependent vowels (front type)
['ေ'] = 'ē', ['ဲ'] = 'ae', ['ော်'] = 'āo', ['ေ့'] = 'e', ['ဲ့'] = 'ea', ['ုဲင့်'] = 'ai', ['ဲုင်'] = 'āi', ['ော့'] = 'ao', ['ို့'] = 'o', ['ို'] = 'ō',
}
function export.tr(text, lang, sc, debug_mode)
if type(text) == 'table' then -- called directly from a template
text = text.args[1]
end
text = gsub(text, '.', pre)
text = gsub(text, '.', tt1)
for k, v in pairs(adjust1) do
text = gsub(text, letter_with_mark..k, v)
end
return text
end
return export