Convert (NOT TRANSLATE) Farsi letters to English letters like Google Translate in PHP
Asked Answered
E

1

11

I want to convert Farsi letters to English letters in PHP and I don't want to translate them. In Farsi we call it Finglish or Pinglish as you can see here :

سلام -> Salam
علی -> Ali

and so on, I searched the web but didn't find any useful API to use. Any idea?

Erlineerlinna answered 16/11, 2015 at 8:57 Comment(4)
You won't find any API for this. Farsi & Urdu are alike. yet they may pronounce or write word in different way. google translate does the same thing, but for language to language that are standard. In short you'll have to design a dictionary for you matching characters. more or less like a parser class. quite laborious work.Mettlesome
Google Translate does this for Farsi and you can write Salam and after pressing space it will be converted to سلام. I wonder if it gives me the API.Erlineerlinna
interesting i didn't knew that. can you provide a link to that? from which language to which it does that? just curious. i can't help much besides that. sorry, Good luckMettlesome
just go to translate.google.com and make the first language Persian, a button appears in the bottom of translate box with caption "چ" if you click the arrow beside it, you'll see the conversion example : salam -> سلام , by enabling this button you can write in English and after pressing space it will become a Persian word.Erlineerlinna
B
6

What you're describing is called transliteration or Romanization. You might want to try using Transliterator::transliterate, which uses ICU transliteration.

Biome answered 22/11, 2015 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.