Module:fa-cls-translit/documentation
This module will transliterate Classical Persian 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:fa-cls-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
.
Background
සංස්කරණයThis template transliterates Persian based how it would be read in Classical Persian. So keep in mind that this template should be used with classical-style vocalization, a guide explaining Classical vocalization can be seen here.
This template may also be used for most eastern dialects of Persian, which do not have any standard vocalizations, but commonly use the classical vocalization. However it will show vowel length for all dialects, even for dialects that no longer possess vowel length such as Hazaragi.
This template should not be used for Modern Iranian Persian, for which Module:fa-ira-translit should be used instead. However, classical Iranian texts should use this module (all Iranian texts before the 13 or 16th century).
Usage notes
සංස්කරණය- In this module, when two semi-vowel characters are near each other the first one becomes the consonant and the second character becomes the vowel. To prevent this, pairing any vowel diacritic to the secondary semivowel will turn it into a consonant.
- Example: خْویش (xwēš) vs خویْش (xōyš)
- Alif must be proceeded by a zabar, to prevent false positives.
- The Sukoon/Jazm diacritic is required for consonant clusters or else the module will return nil.
- This module can transliterate izāfa diacritics by finding when the diacritic zēr is followed by a space instead of a he.
- supports assimilations for Arabic al-
- ma'rūf vowels (āīū) should be denoted with their corresponding short vowel as they would in Arabic; majhūl vowels (ēō) should not have any proceeding vowel diacritics.
- "xwV" can be distinguished from "xV" (silent waaw) with a sukoon, without a sukoon the waaw will be silent.
- Example: خْویش (xwēš) vs خویش (xēš)
Example
සංස්කරණයTest:
گُرُسْنَه چِه کَارِی کُنَد چِهِل نَر، کِه دَهْ لَک بَرْآیَد بَر او بیخَبَر، کِه پَیْمَانشِکَسْت بیدَرَنْگ آمَدَنْد، مِیَانِ تیغ و تِیر و تُفَنْگ آمَدَنْد
Result:
gurusna či kārī kunad čihil nar, ki dah lak bar'āyad bar ō bē-xabar, ki paymān-šikast bē-darang āmadand, miyān-i tēğ u tīr u tufang āmadand
Expected:
gurusna či kārī kunad čihil nar, ki dah lak bar-āyad bar ō bē-xabar, ki paymān-šikast bē-darang āmadand, miyān-i tēğ u tīr u tufang āmadand
Test cases
සංස්කරණය2 of 74 tests failed. (refresh)
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
سَرْاَنْجَام | sar-anjām | sar-anjām | ||
کُروز | kurōz | kurōz | ||
دَهْ | dah | dah | ||
دَه | da | da | ||
سُؤَال | su'āl | su'āl | ||
کُرُوز | kurūz | kurūz | ||
وَاوْ | wāw | wāw | ||
نَوْروز | nawrōz | nawrōz | ||
قَهْوَهاِی | qahwa-ī | qahwa-ī | ||
قَهْوَهیِی | qahwa-yī | qahwa-yī | ||
خْوَانْدَن | xwāndan | xwāndan | ||
خْویش | xwēš | xwēš | ||
خْوَد | xwad | xwad | ||
چَامَهسَرَایِی | čāma-sarāyī | čāma-sarāyī | ||
طَنِین | tanīn | tanīn | ||
لِهٰذَا | lihāzā | lihāzā | ||
قَهْرًا | qahran | qahran | ||
عَصاً | asan | asan | ||
خَانَه | xāna | xāna | ||
کورِیَایِ شُمَالِی | kōriyā-yi šumālī | kōriyā-yi šumālī | ||
ضَمَّه | zamma | zamma | ||
ضَمِّهْ | zammih | zammih | ||
کِه | ki | ki | ||
کِهْ | kih | kih | ||
اَرْمَنِسْتَان | armanistān | armanistān | ||
بَاکُو | bākū | bākū | ||
کَسی | kasē | kasē | ||
بَرَادَرِ بُزُرْگ | barādar-i buzurg | barādar-i buzurg | ||
قُرُونِ وُسْطیٰ | qurūn-i wustā | qurūn-i wustā | ||
دَر-آمَد | dar-āmad | dar-āmad | ||
بَازِیِ شَطْرَنْج | bāzī-yi šatranj | bāzī-yi šatranj | ||
ایرَانِیَان | ērāniyān | ērāniyān | ||
سُؤَال | su'āl | su'āl | ||
صُبَاح | subāh | subāh | ||
صُبْح | subh | subh | ||
صُبْه | subh | subh | ||
دُروغ گویْ | durōğ gōy | durōğ gōy | ||
او | ō | ō | ||
وَ | wa | wa | ||
و | u | u | ||
بَه نَامِ خُدَا | ba nām-i xudā | ba nām-i xudā | ||
جَوَانِی | jawānī | jawānī | ||
شَاهْنَامَه | šāhnāma | šāhnāma | ||
زِنْدَگِی | zindagī | zindagī | ||
زِنْدَهگِی | zinda-gī | zinda-gī | ||
میوَهٔ جَاپَانِی | mēwa-yi jāpānī | mēwa-yi jāpānī | ||
نُوید | nuwēd | nuwēd | ||
دُخْتَرَْبَچَّه | duxtar-bačča | duxtar-bačča | ||
کِیَه | kiya | kiya | ||
کُرُوَاسِیَا | kuruwāsiyā | kuruwāsiyā | ||
مِیَایِین | miyāyīn | miyāyīn | ||
مْیَایین | myāyēn | myāyēn | ||
طِلَّا | tillā | tillā | ||
لیکِن | lēkin | lēkin | ||
بَچَّهٔ لَطِیفَه کَلَان اَسْت | bačča-yi latīfa kalān ast | bačča-yi latīfa kalān ast | ||
مَعْرُوف و مَجْهُول | ma'rūf u majhūl | ma'rūf u majhūl | ||
مَعْرُوف وَ مَجْهُول | ma'rūf wa majhūl | ma'rūf wa majhūl | ||
اَرمنستان | (nil) | (nil) | N/A | |
باکو | (nil) | (nil) | N/A | |
تصویر | (nil) | tswēr | N/A | |
کسی | (nil) | (nil) | N/A | |
برادر بزرگ | (nil) | (nil) | N/A | |
قرون وسطی | (nil) | (nil) | N/A | |
وَٱللّٰه | wal-lāh | wal-lāh | ||
کَسے | kasē | kasē | ||
کَٹَه | kaṭa | kaṭa | ||
آیَةُاللّٰه | āyatu-l-lāh | āyatu-l-lāh | ||
فِالْحَال | fi-l-hāl | fi-l-hāl | ||
بویِ تُو | bō-yi tū | bō-yi tū | ||
بِسْمِ اللّٰهِ الْرَّحْمٰنِ الْرَّحِیم | bismi l-lāhi r-rahmāni r-rahīm | bismi l-lāhi r-rahmāni r-rahīm | ||
اِیَالَاتِ مُتَّحِدَه | iyālāt-i muttahida | iyālāt-i muttahida | ||
دَارُ الخَلَافَه | dāru l-xalāfa | dāru l-xalāfa | ||
اَبُو الهَوْد | abū l-hawd | abū l-hawd | ||
یی | yē | ēy | 1 |