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];
string Transliterate(char English) {
bool upperCase = char.IsUpper(English);
English = English.ToUpper();
int index = (char)English - 0x41;
string result = TransliterationTable[index];
if (upperCase)
result = result.ToUpper;
return TransliterationTable[index];
}
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