模组: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.