Transliterate English text using the Greek alphabet: Difference between revisions
Content added Content deleted
m (→{{header|jq}}: tidy) |
No edit summary |
||
Line 264: | Line 264: | ||
================================================================= |
================================================================= |
||
</pre> |
</pre> |
||
=={{header|M2000 Interpreter}}== |
|||
<syntaxhighlight lang="m2000 interpreter"> |
|||
process1=lambda -> { |
|||
a=list:="ee":="η", "ch":="χ", "kh":="χ", "ph":="φ", "ps":="ψ", "th":="θ", "ck":="κ", "oo":="ω", "rh":="ρ" |
|||
b=list:="a":="α","b":="β","v":="β","g":="γ","d":="δ","e":="ε","z":="ζ","h":="η","i":="ι","j":="ι","c":="κ" |
|||
append b, "k":="κ","q":="κ","l":="λ","m":="μ","n":="ν","x":="ξ","o":="ο","p":="π","r":="ρ" |
|||
append b, "s":="σ","t":="τ","u":="υ","y":="υ","f":="φ","w":="ω" |
|||
=lambda a, b (s as string, no as integer) -> { |
|||
long i=1, j=len(s) |
|||
string r, rc, crlf={ |
|||
} |
|||
while i<=j |
|||
if exist(a, lcase$(mid$(s,i,2))) then |
|||
rc=eval$(a) |
|||
if mid$(s,i,1)<>left$(eval$(a!),1) then |
|||
r+=ucase$(left$(rc,1)) |
|||
else |
|||
r+=rc |
|||
end if |
|||
i+=2 |
|||
else.if exist(b,lcase$(mid$(s,i,1))) then |
|||
rc=eval$(b) // eval$(b!) is the key |
|||
if mid$(s,i,1)<>eval$(b!) then |
|||
r+=ucase$(rc) |
|||
else.if rc="σ" then |
|||
if exist(b,lcase$(mid$(s,i+1,1))) then |
|||
r+=rc |
|||
else |
|||
r+="ς" |
|||
end if |
|||
else |
|||
r+=rc |
|||
end if |
|||
i++ |
|||
else |
|||
r+=mid$(s,i,1) |
|||
i++ |
|||
end if |
|||
end while |
|||
=">>>> Text "+no+crlf+s+crlf+" =>"+crlf+r+crlf+crlf |
|||
} |
|||
} |
|||
trans=process1() |
|||
report trans("The quick brown fox jumped over the lazy dog.", 1) |
|||
eng$={I was looking at some rhododendrons in my back garden, |
|||
dressed in my khaki shorts, when the telephone rang. |
|||
As I answered it, I cheerfully glimpsed that the July sun |
|||
caused a fragment of black pine wax to ooze on the velvet quilt |
|||
laying in my patio.} |
|||
Report trans(eng$, 2) |
|||
Report trans("sphinx of black quartz, judge my vow.", 3) |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
>>>> Text 1 |
|||
The quick brown fox jumped over the lazy dog. |
|||
=> |
|||
Θε κυικ βροων φοξ ιυμπεδ οβερ θε λαζυ δογ. |
|||
>>>> Text 2 |
|||
I was looking at some rhododendrons in my back garden, |
|||
dressed in my khaki shorts, when the telephone rang. |
|||
As I answered it, I cheerfully glimpsed that the July sun |
|||
caused a fragment of black pine wax to ooze on the velvet quilt |
|||
laying in my patio. |
|||
=> |
|||
Ι ωας λωκινγ ατ σομε ροδοδενδρονς ιν μυ βακ γαρδεν, |
|||
δρεσσεδ ιν μυ χακι σηορτς, ωηεν θε τελεφονε ρανγ. |
|||
Ας Ι ανσωερεδ ιτ, Ι χηρφυλλυ γλιμψεδ θατ θε Ιυλυ συν |
|||
καυσεδ α φραγμεντ οφ βλακ πινε ωαξ το ωζε ον θε βελβετ κυιλτ |
|||
λαυινγ ιν μυ πατιο. |
|||
>>>> Text 3 |
|||
sphinx of black quartz, judge my vow. |
|||
=> |
|||
σφινξ οφ βλακ κυαρτζ, ιυδγε μυ βοω. |
|||
</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |