模組:Pi-translit/doc
此頁面為 Module:Pi-translit 的說明文件
Interfacing
編輯這個模組會將巴利語未確定的文字拉丁化。
最好不要直接從模板或其他模組調用此模組。要從模板中使用它,請以{{xlit}}
做為替代;若要在模組中使用,則以Module:languages#Language:transliterate替代。
關於測試用例,請參閱Module:Pi-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
.
This module transliterates Pali text from the Brahmi, Bengali, Burmese, Devanagari, Khmer, Lanna, Lao, Sinhala and Thai scripts in accordance with the IAST convention. It will also transliterate Sanskrit in so far as the Sanskrit writing system is known.
Method
編輯The Wiktionary transliterations of Burmese, Khmer, Lao and Thai are completely incompatible with IAST, and when standardised, it is likely that the Northern Thai (and Lao, Tai Khuen and Tai Lue) convention will also be incompatible. The Sanskrit Devanagari transliteration is compatible, and is therefore used. The Brahmi and Sinhalese transliterations are different from IAST, but similar enough that their outputs are converted to IAST.
The core of the transliteration is the conversion of CV? sequences where V is a vowel or a mark of its absence. Unlike non-pristhamatra Devanagari, a vowel may consist of up to four characters, even in form NFC. The V category includes dependent vowels, viramas, coengs and cancellation marks. The C category includes base consonant, subscript consonants, and the initial parts of multicharacter independent vowels. The CV combination is considered for special translation; this deals with several potentially awkward combinations.
There are also the complications of subscript consonants (in the Burmese and Lanna scripts), nuktas (for Bengali) and ZWNJ. Subscript consonants are handled by Romanising consonants preceding subscript consonants so that the implicit vowel will not be inserted after them.
The handling of preposed Thai and Lao vowels is handled by noting that in abugidas, they may be moved forward past each consonant with a phinthu, and then swapped with one consonant without a phinthu. Octahedron80 advises that in the alphabetic systems, the vowel is written before the last consonant of a cluster.