Click here to Skip to main content
Sign Up to vote bad
good
See more: C++Windows
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 2 Jun '11 - 21:32
manabjn407

Comments
Shradha Gupta - 20 Mar '13 - 4:21
I need a code in .net to convert English language to Marathi. If anybody know then please reply.

3 solutions

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:
 
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
  Permalink  
Comments
SP 24 - 3 Jun '11 - 7:52
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.
SAKryukov - 5 Jun '11 - 22:53
"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.
  Permalink  
Comments
manabjn - 8 Jun '11 - 10:39
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.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 508
1 Arun Vasu 275
2 Maciej Los 228
3 OriginalGriff 215
4 Rohan Leuva 176
0 Sergey Alexandrovich Kryukov 9,670
1 OriginalGriff 7,409
2 CPallini 3,968
3 Rohan Leuva 3,352
4 Maciej Los 2,861


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid