Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
2.23/5 (3 votes)
See more:
I need c# code for converting English alphabet to hindi. If somebody type "M" then it should display hindi "MOH".Similarly ,if we type ENGLISH "MAA" then it should display as "MAA" in Hindi alphabets. Please help me.
Thank you for your kind attention.
Posted
Comments
Shradha G 20-Mar-13 4:21am    
I need a code in .net to convert English language to Marathi. If anybody know then please reply.

Create a look-up table in the form of array of string. Populate it from some text file, for example. The value will be the transliteration (http://en.wikipedia.org/wiki/Transliteration[^]) string of some English character. This way, you will have a function using this array.

But think about it: why not using the standard IPA (http://en.wikipedia.org/wiki/International_Phonetic_Alphabet[^])? As far as I know it covers both English and Hindi well (I know some languages it does not cover well, but with Hindi it should do).

OK, it's up to you. Back to our function:

C#
string[] TransliterationTable = new string[26]; //I assume lo- and hi-case letters are transliterated in the same way

//...

//Populate TransliterationTable from file...

//...

// instance method of the same class
// where TransliterationTable is declared:
string Transliterate(char English) {
   // pre-condition to guarantee: all English chars should be in the table,
   // other code points should not be used in call:
   bool upperCase = char.IsUpper(English);
   English = English.ToUpper();
   int index = (char)English - 0x41; //minus capital English 'A'
   string result = TransliterationTable[index];
   if (upperCase) //assume transliterations are in lower
      result = result.ToUpper;
   return TransliterationTable[index]; 
}

//one more in this class:
string Transliterate(string English) {
   System.Text.StringBuilder sb = new System.Text.StringBuilder();
   foreach(char eng in English)
       sb.Append(this.Transliterate(eng));
   return sb.ToString();
}


Done!

—SA
 
Share this answer
 
Comments
ShilpiP 3-Jun-11 7:52am    
Hi Sakryukov, I have one doubt regarding your second link. How can it be possible to Transliterate English to Hindi. Quite confusing. I have a knowledge of scripts of 11 Indian language and for last 5 year, I am working in Language & Technology. Transliteration of Indian languages is done by me but seriously I don't understand the second link. Please explain :) Thanks in Advance.
Sergey Alexandrovich Kryukov 5-Jun-11 22:53pm    
"How can it be possible to Transliterate English to Hindi". I'm absolutely agree with your concern and wanted to question OP about it. It would make sense to approximately transliterate, say, Russian into Hindi, but not English, as transliteration letter-by-letter would loose the meaning of the word, as in English orthography spelling if too far from phonetics. I merely shown how to implement the OP's procedure. Actually, it's possible to recognize transliterated English text, but it rather has humorous effect sometimes used in literature.

Now, about IPA. There is nothing to explain. The second link has nothing to do with transliteration at all. In my second link I just questioned the transliteration itself. How it's useful? (See my notes above.) From as much as know, it's possible to conduct both English and Hindi phonetics using IPA. Am I right? I understand the value of IPA system (I wish it would be wider; some languages don't feet in the IPA set), but I fail to understand the value of transliteration between scripts and languages. Here I would ask you: can you explain it? In my experience, such transliteration is nothing more then "foreign language for the lamers". Is it not?

Thank you.
--SA
I think you want to create a transliteration logic.
For this first some mapping of word is to be done by using array.
for example:अ is mapped with a
आ is mapped with aa
क is mapped with ka
1)after that you have to implement some logic to check if aa comes after consonant than it should convert it to matra.
 
Share this answer
 
v2
Comments
manabjn 8-Jun-11 10:39am    
Thank you for your help.Please tell me how to mape आ with aa and so on.
Use the character equivalent for the letters and you need to write some code for combining a consonant and a vowel. Use Unicode encoding.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900