Modul:fa-ira-translit

A Wikiszótárból, a nyitott szótárból

Ez a modul ismeretlen nyelv nyelvű szöveg átírására szolgál.

Ezt a modult lehetőleg nem kellene közvetlenül más sablonokból vagy modulokból hívni. Sablonból az {{xlit}}(?) segédsablon, modulból pedig a Module:languages#Language:transliterate metódus használandó.

Függvények[szerkesztés]

tr(text, lang, sc)
Átírja a text szöveg sc kódú írásrendszerrel írott és lang nyelvű részét. Ha az átírás sikertelen, nilt ad vissza.Lua-hiba a(z) Modul:module_categorization modulban a(z) 118. sorban: A lapcímben lévő „fa-ira” nyelvkódot nem ismerte fel a Module:languages vagy a Module:scripts.

Notes[szerkesztés]

THIS MODULE SHOULD NOT BE USED FOR CLASSICAL PERSIAN OR DARI Due to pronunciation differences between modern Iranian Persian from other varieties of Persian, as well ans differences in vowel notation, Iranian Persian cannot be transliterated the same way as other varieties of Persian. If you need to transliterate a variety of Persian other than modern Iranian Persian, use Module:fa-cls-translit.

This module uses Module:fa-cls-translit as a backend.

Test cases[szerkesztés]

5 teszt sikertelen. (frissítés)

Szöveg Várt Tényleges Első eltérés
test_translit_persian:
Sikeres سَرْاَنْجام sar-anjâm sar-anjâm
Sikeres کُروز koruz koruz
Sikeres کُرُوز korowz korowz
Sikeres واو vâv vâv
Sikeres نُوروز nowruz nowruz
Sikeres قَهْوِه‌ای ğahve-i ğahve-i
Sikeres خوانْدَن xândan xândan
Sikeres خویش xiš xiš
Sikeres خوَد xod xod
Sikeres چامِه‌سَرایی čâme-sarâyi čâme-sarâyi
Sikeres چامه‌سَرایی (nil) (nil) N/A
Sikeres طَنین tanin tanin
Sikeres طَنِین taneyn taneyn
Sikeres لِهٰذا lehâzâ lehâzâ
Sikeres عَصاً 'asan 'asan
Sikeres خانه (nil) (nil) N/A
Sikeres خانِه xâne xâne
Sikeres کُرِهٔ شُمالی kore-ye šomâli kore-ye šomâli
Sikeres ضَمّه (nil) (nil) N/A
Sikeres ضَمِّه zamme zamme
Sikeres وُدْکا vodkâ vodkâ
Sikeres اَرْمَنِسْتان armanestân armanestân
Sikeres باکو bâku bâku
Sikeres بَرادَرِ بُزُرْگ barâdar-e bozorg barâdar-e bozorg
Sikeres قُرونِ وُسْطیٰ ğorun-e vostâ ğorun-e vostâ
Sikeres دَرْ-آمَد dar-âmad dar-âmad
Sikeres بازیِ شَطْرَنْج bâzi-ye šatranj bâzi-ye šatranj
Sikeres متعلق (nil) (nil) N/A
Sikeres مُتَعَلِّق mota'alleğ mota'alleğ
Sikeres اِتِّحادِیِهٔ اُروپا ettehâdiye-ye orupâ ettehâdiye-ye orupâ
Sikeres آیَتُ‌اللّٰه âyato-llâh âyato-llâh
Sikeres شِیْخ šeyx šeyx
Sikeres نُوْروز nowruz nowruz
Sikertelen پَیام payâm peyâm 2
Sikertelen اَیّوب ayyub eyّub 1
Sikertelen شِبْه‌ِجَزیرِه šebh-e-jazire šebh-ejazire 7
Sikertelen پایْگاه‌ِدادِه pâygâh-e-dâde pâygâh-edâde 9
Sikertelen صَحْرایِ ‬غَرْبی sahrâ-ye ğarbi (nil) N/A



local U = mw.ustring.char
local gsub = mw.ustring.gsub
local export = {}

local fatHatan = U(0x64B)
local zabar = U(0x64E)
local zer = U(0x650)
local pesh = U(0x64F)
local tashdid = U(0x651) -- also called shadda
local jazm = "ْ"
local he = "ه"
local zwnj = U(0x200C)
local highhmz = U(0x654)
local alef_wasla = "ٱ"
local balticons = "ڃڇڑڗݜݨݩǩ"
local consonants = "ءبپتټٹثجچحخدډڈذرزژسشصضطظعغفقکگلمنؤهئ"
local consonants2 = "ءبپتټٹثجچحخدډڈذرزژسشصضطظعغفقکگلمنوؤهیئyw" .. balticons -- including semivowels
 
local ain = 'ع'
local alif = 'ا'
local ye = 'ی'
local ye2 = 'ئ'
local ye3 = 'ے' -- for balti
local vao = "و"
local function clscheck(text, lang, sc)
	return require("Module:fa-cls-translit").tr(text, lang, sc)
end
-- this has the fa-cls-translit perform the diactic check and other basic functions 

function export.tr(text, lang, sc)
	text = gsub(text, alif .. fatHatan , fatHatan)
	text = gsub(text, "([" .. consonants2 .. "])" .. alif , "%1" .. zabar .. alif)
	text = gsub(text, pesh .. vao .. "([" .. consonants .. jazm .. "])", zabar .. vao .. "%1" )
	text = gsub(text, zer .. ye .. "([" .. consonants .. jazm .. "])", zabar .. ye .. "%1" )
	-- alows an alif without a zabar to work
	text = clscheck(text, lang, sc)
	if text == nil then --prevent module from breaking if diacritic check fails
		return nil
	end
	text = gsub(text, "e" .. " ", "e-ye")
	text = gsub(text, "iy", "ēy")
	text = gsub(text, "y%-i", "ē-yi")
	text = gsub(text, "q", "ğ")
	text = gsub(text, "ww", "vv")
	text = gsub(text, "i", "e")
	text = gsub(text, "u", "o")
	text = gsub(text, "ē", "i")
	text = gsub(text, "ay([^yaâeoiu])", "ī%1")
	text = gsub(text, "ī", "ey")
	text = gsub(text, "ō", "u")
	text = gsub(text, "ā", "â")
	text = gsub(text, "w([aâeoiu])", "v%1")
	text = gsub(text, "aw", "ū")
	text = gsub(text, "w", "v")
	text = gsub(text, "ū", "ow")
	return text
end
 
return export