Module:sa-Java-translit/documentation

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Documentation for Module:sa-Java-translit. [edit]
This page contains usage information, categories, interwiki links and other content describing the module.

Interfacing

[edit]

This module works on text in the Javanese script. This module will transliterate Sanskrit language text per WT:SA TR. 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:sa-Java-translit/testcases.

Functions

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

It transliterates Sanskrit text in accordance with the IAST convention.

Method

[edit]

The core of the transliteration is the conversion of CV? sequences where V is a vowel or a mark of its absence. The Javanese script is more complicated than the Devanagari script, so the process is a bit more complicated.

The characters of the script that may be transliterated consist of consonants, both base and subscript consonants, dependent vowels, and others. The base consonants are listed in the variable C and the subscript consonants are listed in the variable S. Their transliterations are stored in the table consonants. The transliterations of the dependent vowels are stored in the table diacritics. Other transliterations are stored in the table tt. These include independent vowels and anusvara.

The first step is to partially transliterate the sequences 'CS', for there is no implicit vowel between the two parts. The 'C' part is transliterated, and the 'S' part is left for further consideration. This step is repeated, so as to handle any potential sequences CSSS, though there should not be any.

The next step is to transliterate CV? combinations. Some vowels are encoded as three characters (virama, liquid vowel letter, and length mark). (TODO: Trap undefined sequences.) The structure of vowels is simple enough to be captured inline in the coding of the substitution. Note that if there were any CSSS sequences, the first letters of the transliterations of the subscript consonants would have to be treated as vowels.

The final step is to transliterate the other symbols. Some symbols (certain of the independent vowels) have a second character, which is always TARUNG. These are transliterated first, and then the symbols consisting of a single character are transliterated.