Module:fa-cls-translit/documentation

Documentation for Module:fa-cls-translit. [edit]
This page contains usage information, categories, interwiki links and other content describing the module.

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 code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

Background

edit

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

edit
  1. 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š)
  2. Alif must be proceeded by a zabar, to prevent false positives.
  3. The Sukoon/Jazm diacritic is required for consonant clusters or else the module will return nil.
  4. This module can transliterate izāfa diacritics by finding when the diacritic zēr is followed by a space instead of a he.
  5. supports assimilations for Arabic al-
  6. 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.
  7. "xwV" can be distinguished from "xV" (silent waaw) with a sukoon, without a sukoon the waaw will be silent.
    • Example: خْویش (xwēš) vs خویش (xēš)

Example

edit

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

edit

All tests passed. (refresh)

TextExpectedActualDiffers at
test_translit_persian:
 سَرْاَنْجَامsar-anjāmsar-anjām
 کُروزkurōzkurōz
 دَهْdahdah
 دَهdada
 سُؤَالsu'ālsu'āl
 کُرُوزkurūzkurūz
 وَاوْwāwwāw
 نَوْروزnawrōznawrōz
 قَهْوَه‌اِیqahwa-īqahwa-ī
 قَهْوَه‌یِیqahwa-yīqahwa-yī
 خْوَانْدَنxwāndanxwāndan
 خْویشxwēšxwēš
 خْوَدxwadxwad
 چَامَه‌سَرَایِیčāma-sarāyīčāma-sarāyī
 طَنِینtanīntanīn
 لِهٰذَاlihāzālihāzā
 عَصاًasanasan
 خَانَهxānaxāna
 کورِیَایِ شُمَالِیkōriyā-yi šumālīkōriyā-yi šumālī
 ضَمَّهzammazamma
 ضَمِّهْzammihzammih
 کِهkiki
 کِهْkihkih
 اَرْمَنِسْتَانarmanistānarmanistān
 بَاکُوbākūbākū
 کَسیkasēkasē
 بَرَادَرِ بُزُرْگbarādar-i buzurgbarādar-i buzurg
 قُرُونِ وُسْطیٰqurūn-i wustāqurūn-i wustā
 دَر-آمَدdar-āmaddar-āmad
 بَازِیِ شَطْرَنْجbāzī-yi šatranjbāzī-yi šatranj
 ایرَانِیَانērāniyānērāniyān
 سُؤَالsu'ālsu'āl
 صُبَاحsubāhsubāh
 صُبْحsubhsubh
 صُبْهsubhsubh
 دُروغ گویْdurōğ gōydurōğ gōy
 اوōō
 وَwawa
 و 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ēdnuwēd
 دُخْتَرَْبَچَّهduxtar-baččaduxtar-bačča
 کِیَهkiyakiya
 کُرُوَاسِیَاkuruwāsiyākuruwāsiyā
 مِیَایِینmiyāyīnmiyāyīn
 مْیَایینmyāyēnmyāyēn
 طِلَّاtillātillā
 لیکِنlēkinlēkin
 بَچَّهٔ لَطِیفَه کَلَان اَسْتbačča-yi latīfa kalān astbačča-yi latīfa kalān ast
 مَعْرُوف و مَجْهُولma'rūf u majhūlma'rūf u majhūl
 مَعْرُوف وَ مَجْهُولma'rūf wa majhūlma'rūf wa majhūl
 اَرمنستان(nil)(nil)N/A
 باکو(nil)(nil)N/A
 کسی(nil)(nil)N/A
 برادر بزرگ(nil)(nil)N/A
 قرون وسطی(nil)(nil)N/A
 وَٱللّٰهwallāhwallāh
 آیَةُ‌اللّٰهāyatu-llāhāyatu-llāh
 فِالْحَالfi-l-hālfi-l-hāl
 کَسےkasēkasē
 کَٹَهkaṭakaṭa
 بویِ تُوbō-yi tūbō-yi tū
 بِسْمِ اللّٰهِ الْرَّحْمٰنِ الْرَّحِیمbism-i llāh-i rrahmān-i rrahīmbism-i llāh-i rrahmān-i rrahīm
 اِیَالَاتِ مُتَّحِدَهiyālāt-i muttahidaiyālāt-i muttahida